[PATCH 2/2] mini-os: add config options for xen libraries

Juergen Gross posted 2 patches 3 years, 1 month ago
[PATCH 2/2] mini-os: add config options for xen libraries
Posted by Juergen Gross 3 years, 1 month ago
Today close hooks into libxenctrl, libxenevtchn and libxengnttab are
under the CONFIG_XC umbrella. In order to support Mini-OS builds using
stable Xen libraries only, add CONFIG_LIBXENCTRL, CONFIG_LIBXENEVTCHN
and CONFIG_LIBXENGNTTAB config options.

In case CONFIG_XC was specified in the Mini-OS config explicitly, set
the three new variables to the specified value.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 Config.mk                     | 7 ++++++-
 arch/x86/testbuild/all-no     | 4 +++-
 arch/x86/testbuild/all-yes    | 9 +++++----
 arch/x86/testbuild/newxen-yes | 9 +++++----
 lib/sys.c                     | 8 ++++++--
 5 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/Config.mk b/Config.mk
index 8f4cea9..5e66089 100644
--- a/Config.mk
+++ b/Config.mk
@@ -195,7 +195,12 @@ CONFIG-y += CONFIG_PARAVIRT
 else
 CONFIG-n += CONFIG_PARAVIRT
 endif
-CONFIG-$(libc) += CONFIG_XC
+# Support legacy CONFIG_XC value
+CONFIG_XC ?= $(libc)
+CONFIG-$(CONFIG_XC) += CONFIG_LIBXENCTRL
+CONFIG-$(CONFIG_XC) += CONFIG_LIBXENEVTCHN
+CONFIG-$(CONFIG_XC) += CONFIG_LIBXENGNTTAB
+
 CONFIG-$(lwip) += CONFIG_LWIP
 
 $(foreach i,$(CONFIG-y),$(eval $(i) ?= y))
diff --git a/arch/x86/testbuild/all-no b/arch/x86/testbuild/all-no
index 1c50bba..7972ecd 100644
--- a/arch/x86/testbuild/all-no
+++ b/arch/x86/testbuild/all-no
@@ -13,7 +13,9 @@ CONFIG_FBFRONT = n
 CONFIG_KBDFRONT = n
 CONFIG_CONSFRONT = n
 CONFIG_XENBUS = n
-CONFIG_XC = n
+CONFIG_LIBXENCTRL = n
+CONFIG_LIBXENEVTCHN = n
+CONFIG_LIBXENGNTTAB = n
 CONFIG_LWIP = n
 CONFIG_BALLOON = n
 CONFIG_USE_XEN_CONSOLE = n
diff --git a/arch/x86/testbuild/all-yes b/arch/x86/testbuild/all-yes
index 5464342..bc8eea5 100644
--- a/arch/x86/testbuild/all-yes
+++ b/arch/x86/testbuild/all-yes
@@ -13,9 +13,10 @@ CONFIG_FBFRONT = y
 CONFIG_KBDFRONT = y
 CONFIG_CONSFRONT = y
 CONFIG_XENBUS = y
-# XC is special: it needs support from outside
-CONFIG_XC = n
-# LWIP is special: it needs support from outside
-CONFIG_LWIP = n
 CONFIG_BALLOON = y
 CONFIG_USE_XEN_CONSOLE = y
+# The following are special: they need support from outside
+CONFIG_LIBXENCTRL = n
+CONFIG_LIBXENEVTCHN = n
+CONFIG_LIBXENGNTTAB = n
+CONFIG_LWIP = n
diff --git a/arch/x86/testbuild/newxen-yes b/arch/x86/testbuild/newxen-yes
index 2a3ed2e..f72123b 100644
--- a/arch/x86/testbuild/newxen-yes
+++ b/arch/x86/testbuild/newxen-yes
@@ -13,10 +13,11 @@ CONFIG_FBFRONT = y
 CONFIG_KBDFRONT = y
 CONFIG_CONSFRONT = y
 CONFIG_XENBUS = y
-# XC is special: it needs support from outside
-CONFIG_XC = n
-# LWIP is special: it needs support from outside
-CONFIG_LWIP = n
 CONFIG_BALLOON = y
 CONFIG_USE_XEN_CONSOLE = y
 XEN_INTERFACE_VERSION=__XEN_LATEST_INTERFACE_VERSION__
+# The following are special: they need support from outside
+CONFIG_LIBXENCTRL = n
+CONFIG_LIBXENEVTCHN = n
+CONFIG_LIBXENGNTTAB = n
+CONFIG_LWIP = n
diff --git a/lib/sys.c b/lib/sys.c
index c6a7b9f..e8d5eb2 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -437,13 +437,17 @@ int close(int fd)
 	    return res;
 	}
 #endif
-#ifdef CONFIG_XC
+#ifdef CONFIG_LIBXENCTRL
 	case FTYPE_XC:
 	    minios_interface_close_fd(fd);
 	    return 0;
+#endif
+#ifdef CONFIG_LIBXENEVTCHN
 	case FTYPE_EVTCHN:
 	    minios_evtchn_close_fd(fd);
             return 0;
+#endif
+#ifdef CONFIG_LIBXENGNTTAB
 	case FTYPE_GNTMAP:
 	    minios_gnttab_close_fd(fd);
 	    return 0;
@@ -1373,7 +1377,7 @@ void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset
 
     if (fd == -1)
         return map_zero(n, 1);
-#ifdef CONFIG_XC
+#ifdef CONFIG_LIBXENCTRL
     else if (files[fd].type == FTYPE_XC) {
         unsigned long zero = 0;
         return map_frames_ex(&zero, n, 0, 0, 1, DOMID_SELF, NULL, 0);
-- 
2.26.2


Re: [PATCH 2/2] mini-os: add config options for xen libraries
Posted by Samuel Thibault 3 years, 1 month ago
Juergen Gross, le lun. 04 oct. 2021 16:19:24 +0200, a ecrit:
> Today close hooks into libxenctrl, libxenevtchn and libxengnttab are
> under the CONFIG_XC umbrella. In order to support Mini-OS builds using
> stable Xen libraries only, add CONFIG_LIBXENCTRL, CONFIG_LIBXENEVTCHN
> and CONFIG_LIBXENGNTTAB config options.
> 
> In case CONFIG_XC was specified in the Mini-OS config explicitly, set
> the three new variables to the specified value.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Thanks!

> ---
>  Config.mk                     | 7 ++++++-
>  arch/x86/testbuild/all-no     | 4 +++-
>  arch/x86/testbuild/all-yes    | 9 +++++----
>  arch/x86/testbuild/newxen-yes | 9 +++++----
>  lib/sys.c                     | 8 ++++++--
>  5 files changed, 25 insertions(+), 12 deletions(-)
> 
> diff --git a/Config.mk b/Config.mk
> index 8f4cea9..5e66089 100644
> --- a/Config.mk
> +++ b/Config.mk
> @@ -195,7 +195,12 @@ CONFIG-y += CONFIG_PARAVIRT
>  else
>  CONFIG-n += CONFIG_PARAVIRT
>  endif
> -CONFIG-$(libc) += CONFIG_XC
> +# Support legacy CONFIG_XC value
> +CONFIG_XC ?= $(libc)
> +CONFIG-$(CONFIG_XC) += CONFIG_LIBXENCTRL
> +CONFIG-$(CONFIG_XC) += CONFIG_LIBXENEVTCHN
> +CONFIG-$(CONFIG_XC) += CONFIG_LIBXENGNTTAB
> +
>  CONFIG-$(lwip) += CONFIG_LWIP
>  
>  $(foreach i,$(CONFIG-y),$(eval $(i) ?= y))
> diff --git a/arch/x86/testbuild/all-no b/arch/x86/testbuild/all-no
> index 1c50bba..7972ecd 100644
> --- a/arch/x86/testbuild/all-no
> +++ b/arch/x86/testbuild/all-no
> @@ -13,7 +13,9 @@ CONFIG_FBFRONT = n
>  CONFIG_KBDFRONT = n
>  CONFIG_CONSFRONT = n
>  CONFIG_XENBUS = n
> -CONFIG_XC = n
> +CONFIG_LIBXENCTRL = n
> +CONFIG_LIBXENEVTCHN = n
> +CONFIG_LIBXENGNTTAB = n
>  CONFIG_LWIP = n
>  CONFIG_BALLOON = n
>  CONFIG_USE_XEN_CONSOLE = n
> diff --git a/arch/x86/testbuild/all-yes b/arch/x86/testbuild/all-yes
> index 5464342..bc8eea5 100644
> --- a/arch/x86/testbuild/all-yes
> +++ b/arch/x86/testbuild/all-yes
> @@ -13,9 +13,10 @@ CONFIG_FBFRONT = y
>  CONFIG_KBDFRONT = y
>  CONFIG_CONSFRONT = y
>  CONFIG_XENBUS = y
> -# XC is special: it needs support from outside
> -CONFIG_XC = n
> -# LWIP is special: it needs support from outside
> -CONFIG_LWIP = n
>  CONFIG_BALLOON = y
>  CONFIG_USE_XEN_CONSOLE = y
> +# The following are special: they need support from outside
> +CONFIG_LIBXENCTRL = n
> +CONFIG_LIBXENEVTCHN = n
> +CONFIG_LIBXENGNTTAB = n
> +CONFIG_LWIP = n
> diff --git a/arch/x86/testbuild/newxen-yes b/arch/x86/testbuild/newxen-yes
> index 2a3ed2e..f72123b 100644
> --- a/arch/x86/testbuild/newxen-yes
> +++ b/arch/x86/testbuild/newxen-yes
> @@ -13,10 +13,11 @@ CONFIG_FBFRONT = y
>  CONFIG_KBDFRONT = y
>  CONFIG_CONSFRONT = y
>  CONFIG_XENBUS = y
> -# XC is special: it needs support from outside
> -CONFIG_XC = n
> -# LWIP is special: it needs support from outside
> -CONFIG_LWIP = n
>  CONFIG_BALLOON = y
>  CONFIG_USE_XEN_CONSOLE = y
>  XEN_INTERFACE_VERSION=__XEN_LATEST_INTERFACE_VERSION__
> +# The following are special: they need support from outside
> +CONFIG_LIBXENCTRL = n
> +CONFIG_LIBXENEVTCHN = n
> +CONFIG_LIBXENGNTTAB = n
> +CONFIG_LWIP = n
> diff --git a/lib/sys.c b/lib/sys.c
> index c6a7b9f..e8d5eb2 100644
> --- a/lib/sys.c
> +++ b/lib/sys.c
> @@ -437,13 +437,17 @@ int close(int fd)
>  	    return res;
>  	}
>  #endif
> -#ifdef CONFIG_XC
> +#ifdef CONFIG_LIBXENCTRL
>  	case FTYPE_XC:
>  	    minios_interface_close_fd(fd);
>  	    return 0;
> +#endif
> +#ifdef CONFIG_LIBXENEVTCHN
>  	case FTYPE_EVTCHN:
>  	    minios_evtchn_close_fd(fd);
>              return 0;
> +#endif
> +#ifdef CONFIG_LIBXENGNTTAB
>  	case FTYPE_GNTMAP:
>  	    minios_gnttab_close_fd(fd);
>  	    return 0;
> @@ -1373,7 +1377,7 @@ void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset
>  
>      if (fd == -1)
>          return map_zero(n, 1);
> -#ifdef CONFIG_XC
> +#ifdef CONFIG_LIBXENCTRL
>      else if (files[fd].type == FTYPE_XC) {
>          unsigned long zero = 0;
>          return map_frames_ex(&zero, n, 0, 0, 1, DOMID_SELF, NULL, 0);
> -- 
> 2.26.2
> 

-- 
Samuel
<y> update-menus: relocation error: update-menus: symbol _ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E, version GLIBCPP_3.2 not defined in file libstdc++.so.5 with link time reference
<y> quoi que ça peut bien vouloir dire ?
<D> N a eu la meme merde
<y> c ça que ça veut dire ? wow, c'est bien crypté :)
 -+- #ens-mim s'entraide -+-