diff mbox series

[RFC,3/6] roles: add a role for xenstore domain

Message ID 20230801202006.20322-4-dpsmith@apertussolutions.com (mailing list archive)
State New, archived
Headers show
Series Hyperlaunch domain roles and capabilities | expand

Commit Message

Daniel P. Smith Aug. 1, 2023, 8:20 p.m. UTC
Expand the possible roles for a domain to include a role for the Xenstore
domain.

Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/common/domain.c     | 3 +++
 xen/include/xen/sched.h | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Stefano Stabellini Aug. 2, 2023, 12:57 a.m. UTC | #1
On Tue, 1 Aug 2023, Daniel P. Smith wrote:
> Expand the possible roles for a domain to include a role for the Xenstore
> domain.
> 
> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/common/domain.c     | 3 +++
>  xen/include/xen/sched.h | 3 ++-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index 0ff1d52e3d..dbf055c559 100644
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -633,6 +633,9 @@ struct domain *domain_create(domid_t domid,
>          d->role |= ROLE_HARDWARE_DOMAIN;
>      }
>  
> +    if ( d->options & XEN_DOMCTL_CDF_xs_domain )
> +        d->role |= ROLE_XENSTORE_DOMAIN;
> +
>      TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id);
>  
>      lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid);
> diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
> index 695f240326..ec0f9baff6 100644
> --- a/xen/include/xen/sched.h
> +++ b/xen/include/xen/sched.h
> @@ -470,6 +470,7 @@ struct domain
>  #define ROLE_UNBOUNDED_DOMAIN  (1U<<0)
>  #define ROLE_CONTROL_DOMAIN    (1U<<1)
>  #define ROLE_HARDWARE_DOMAIN   (1U<<2)
> +#define ROLE_XENSTORE_DOMAIN   (1U<<3)
>      uint8_t          role;
>      /* Can this guest access the Xen console? */
>      bool             is_console;
> @@ -1165,7 +1166,7 @@ static inline bool is_vcpu_online(const struct vcpu *v)
>  
>  static inline bool is_xenstore_domain(const struct domain *d)
>  {
> -    return d->options & XEN_DOMCTL_CDF_xs_domain;
> +    return d->role & ROLE_XENSTORE_DOMAIN;
>  }
>  
>  static always_inline bool is_iommu_enabled(const struct domain *d)
> -- 
> 2.20.1
>
Daniel P. Smith Aug. 3, 2023, 2:13 p.m. UTC | #2
On 8/1/23 20:57, Stefano Stabellini wrote:
> On Tue, 1 Aug 2023, Daniel P. Smith wrote:
>> Expand the possible roles for a domain to include a role for the Xenstore
>> domain.
>>
>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
> 
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Thank you!

>> ---
>>   xen/common/domain.c     | 3 +++
>>   xen/include/xen/sched.h | 3 ++-
>>   2 files changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/xen/common/domain.c b/xen/common/domain.c
>> index 0ff1d52e3d..dbf055c559 100644
>> --- a/xen/common/domain.c
>> +++ b/xen/common/domain.c
>> @@ -633,6 +633,9 @@ struct domain *domain_create(domid_t domid,
>>           d->role |= ROLE_HARDWARE_DOMAIN;
>>       }
>>   
>> +    if ( d->options & XEN_DOMCTL_CDF_xs_domain )
>> +        d->role |= ROLE_XENSTORE_DOMAIN;
>> +
>>       TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id);
>>   
>>       lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid);
>> diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
>> index 695f240326..ec0f9baff6 100644
>> --- a/xen/include/xen/sched.h
>> +++ b/xen/include/xen/sched.h
>> @@ -470,6 +470,7 @@ struct domain
>>   #define ROLE_UNBOUNDED_DOMAIN  (1U<<0)
>>   #define ROLE_CONTROL_DOMAIN    (1U<<1)
>>   #define ROLE_HARDWARE_DOMAIN   (1U<<2)
>> +#define ROLE_XENSTORE_DOMAIN   (1U<<3)
>>       uint8_t          role;
>>       /* Can this guest access the Xen console? */
>>       bool             is_console;
>> @@ -1165,7 +1166,7 @@ static inline bool is_vcpu_online(const struct vcpu *v)
>>   
>>   static inline bool is_xenstore_domain(const struct domain *d)
>>   {
>> -    return d->options & XEN_DOMCTL_CDF_xs_domain;
>> +    return d->role & ROLE_XENSTORE_DOMAIN;
>>   }
>>   
>>   static always_inline bool is_iommu_enabled(const struct domain *d)
>> -- 
>> 2.20.1
>>
diff mbox series

Patch

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 0ff1d52e3d..dbf055c559 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -633,6 +633,9 @@  struct domain *domain_create(domid_t domid,
         d->role |= ROLE_HARDWARE_DOMAIN;
     }
 
+    if ( d->options & XEN_DOMCTL_CDF_xs_domain )
+        d->role |= ROLE_XENSTORE_DOMAIN;
+
     TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id);
 
     lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 695f240326..ec0f9baff6 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -470,6 +470,7 @@  struct domain
 #define ROLE_UNBOUNDED_DOMAIN  (1U<<0)
 #define ROLE_CONTROL_DOMAIN    (1U<<1)
 #define ROLE_HARDWARE_DOMAIN   (1U<<2)
+#define ROLE_XENSTORE_DOMAIN   (1U<<3)
     uint8_t          role;
     /* Can this guest access the Xen console? */
     bool             is_console;
@@ -1165,7 +1166,7 @@  static inline bool is_vcpu_online(const struct vcpu *v)
 
 static inline bool is_xenstore_domain(const struct domain *d)
 {
-    return d->options & XEN_DOMCTL_CDF_xs_domain;
+    return d->role & ROLE_XENSTORE_DOMAIN;
 }
 
 static always_inline bool is_iommu_enabled(const struct domain *d)