On Tue, Jul 07, 2015 at 06:36:53PM +0200, Thomas Huth wrote:> On Thu, 2 Jul 2015 11:32:52 +0200 > "Michael S. Tsirkin" <mst at redhat.com> wrote: > > > On Thu, Jul 02, 2015 at 11:12:56AM +0200, Greg Kurz wrote: > > > On Thu, 2 Jul 2015 08:01:28 +0200 > > > "Michael S. Tsirkin" <mst at redhat.com> wrote: > ... > > > > Yea, well - support for legacy BE guests on the new LE hosts is > > > > exactly the motivation for this. > > > > > > > > I dislike it too, but there are two redeeming properties that > > > > made me merge this: > > > > > > > > 1. It's a trivial amount of code: since we wrap host/guest accesses > > > > anyway, almost all of it is well hidden from drivers. > > > > > > > > 2. Sane platforms would never set flags like VHOST_CROSS_ENDIAN_LEGACY - > > > > and when it's clear, there's zero overhead (as some point it was > > > > tested by compiling with and without the patches, got the same > > > > stripped binary). > > > > > > > > Maybe we could create a Kconfig symbol to enforce point (2): prevent > > > > people from enabling it e.g. on x86. I will look into this - but it can > > > > be done by a patch on top, so I think this can be merged as is. > > > > > > > > > > This cross-endian *oddity* is targeting PowerPC book3s_64 processors... I > > > am not aware of any other users. Maybe create a symbol that would > > > be only selected by PPC_BOOK3S_64 ? > > > > I think some ARM systems are trying to support cross-endian > > configurations as well. > > > > Besides that, yes, this is more or less what I had in mind. > > Would something simple like this already do the job: > > diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig > --- a/drivers/vhost/Kconfig > +++ b/drivers/vhost/Kconfig > @@ -35,6 +35,7 @@ config VHOST > > config VHOST_CROSS_ENDIAN_LEGACY > bool "Cross-endian support for vhost" > + depends on KVM_BOOK3S_64 || KVM_ARM_HOST > default n > ---help--- > This option allows vhost to support guests with a different byte > > ?Do all ARM hosts support this dynamic endian-ness?> If that looks acceptable, I can submit a proper patch if you like. > > ThomasI think I prefer some kind of symbol defined by these arches, so I don't get to maintain an arch list in vhost. -- MST
Thomas Huth
2015-Jul-09 07:49 UTC
[PATCH] KVM: Add Kconfig option to signal cross-endian guests
The option for supporting cross-endianness legacy guests in the vhost and tun code should only be available on systems that support cross-endian guests. Signed-off-by: Thomas Huth <thuth at redhat.com> --- arch/arm/kvm/Kconfig | 1 + arch/arm64/kvm/Kconfig | 1 + arch/powerpc/kvm/Kconfig | 1 + drivers/net/Kconfig | 1 + drivers/vhost/Kconfig | 1 + virt/kvm/Kconfig | 3 +++ 6 files changed, 8 insertions(+) diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig index bfb915d..9d8f363 100644 --- a/arch/arm/kvm/Kconfig +++ b/arch/arm/kvm/Kconfig @@ -31,6 +31,7 @@ config KVM select KVM_VFIO select HAVE_KVM_EVENTFD select HAVE_KVM_IRQFD + select KVM_CROSS_ENDIAN_GUESTS depends on ARM_VIRT_EXT && ARM_LPAE && ARM_ARCH_TIMER ---help--- Support hosting virtualized guest machines. diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig index bfffe8f..9af39fe 100644 --- a/arch/arm64/kvm/Kconfig +++ b/arch/arm64/kvm/Kconfig @@ -31,6 +31,7 @@ config KVM select KVM_VFIO select HAVE_KVM_EVENTFD select HAVE_KVM_IRQFD + select KVM_CROSS_ENDIAN_GUESTS ---help--- Support hosting virtualized guest machines. diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig index 3caec2c..e028710 100644 --- a/arch/powerpc/kvm/Kconfig +++ b/arch/powerpc/kvm/Kconfig @@ -79,6 +79,7 @@ config KVM_BOOK3S_64_HV select KVM_BOOK3S_HV_POSSIBLE select MMU_NOTIFIER select CMA + select KVM_CROSS_ENDIAN_GUESTS ---help--- Support running unmodified book3s_64 guest kernels in virtual machines on POWER7 and PPC970 processors that have diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index c18f9e6..0c4ce47 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -261,6 +261,7 @@ config TUN config TUN_VNET_CROSS_LE bool "Support for cross-endian vnet headers on little-endian kernels" default n + depends on KVM_CROSS_ENDIAN_GUESTS ---help--- This option allows TUN/TAP and MACVTAP device drivers in a little-endian kernel to parse vnet headers that come from a diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig index 533eaf0..4d8ae6b 100644 --- a/drivers/vhost/Kconfig +++ b/drivers/vhost/Kconfig @@ -35,6 +35,7 @@ config VHOST config VHOST_CROSS_ENDIAN_LEGACY bool "Cross-endian support for vhost" + depends on KVM_CROSS_ENDIAN_GUESTS default n ---help--- This option allows vhost to support guests with a different byte diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig index e2c876d..cc7b28a 100644 --- a/virt/kvm/Kconfig +++ b/virt/kvm/Kconfig @@ -47,3 +47,6 @@ config KVM_GENERIC_DIRTYLOG_READ_PROTECT config KVM_COMPAT def_bool y depends on COMPAT && !S390 + +config KVM_CROSS_ENDIAN_GUESTS + bool -- 1.8.3.1
Laurent Vivier
2015-Jul-09 09:48 UTC
[PATCH] KVM: Add Kconfig option to signal cross-endian guests
On 09/07/2015 09:49, Thomas Huth wrote:> The option for supporting cross-endianness legacy guests in > the vhost and tun code should only be available on systems > that support cross-endian guests.I'm sure I misunderstand something, but what happens if we use QEMU with TCG instead of KVM, i.e. a big endian powerpc kernel guest on x86_64 little endian host ? Do you forbid the use of vhost in this case ?> Signed-off-by: Thomas Huth <thuth at redhat.com> > --- > arch/arm/kvm/Kconfig | 1 + > arch/arm64/kvm/Kconfig | 1 + > arch/powerpc/kvm/Kconfig | 1 + > drivers/net/Kconfig | 1 + > drivers/vhost/Kconfig | 1 + > virt/kvm/Kconfig | 3 +++ > 6 files changed, 8 insertions(+) > > diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig > index bfb915d..9d8f363 100644 > --- a/arch/arm/kvm/Kconfig > +++ b/arch/arm/kvm/Kconfig > @@ -31,6 +31,7 @@ config KVM > select KVM_VFIO > select HAVE_KVM_EVENTFD > select HAVE_KVM_IRQFD > + select KVM_CROSS_ENDIAN_GUESTS > depends on ARM_VIRT_EXT && ARM_LPAE && ARM_ARCH_TIMER > ---help--- > Support hosting virtualized guest machines. > diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig > index bfffe8f..9af39fe 100644 > --- a/arch/arm64/kvm/Kconfig > +++ b/arch/arm64/kvm/Kconfig > @@ -31,6 +31,7 @@ config KVM > select KVM_VFIO > select HAVE_KVM_EVENTFD > select HAVE_KVM_IRQFD > + select KVM_CROSS_ENDIAN_GUESTS > ---help--- > Support hosting virtualized guest machines. > > diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig > index 3caec2c..e028710 100644 > --- a/arch/powerpc/kvm/Kconfig > +++ b/arch/powerpc/kvm/Kconfig > @@ -79,6 +79,7 @@ config KVM_BOOK3S_64_HV > select KVM_BOOK3S_HV_POSSIBLE > select MMU_NOTIFIER > select CMA > + select KVM_CROSS_ENDIAN_GUESTS > ---help--- > Support running unmodified book3s_64 guest kernels in > virtual machines on POWER7 and PPC970 processors that have > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig > index c18f9e6..0c4ce47 100644 > --- a/drivers/net/Kconfig > +++ b/drivers/net/Kconfig > @@ -261,6 +261,7 @@ config TUN > config TUN_VNET_CROSS_LE > bool "Support for cross-endian vnet headers on little-endian kernels" > default n > + depends on KVM_CROSS_ENDIAN_GUESTS > ---help--- > This option allows TUN/TAP and MACVTAP device drivers in a > little-endian kernel to parse vnet headers that come from a > diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig > index 533eaf0..4d8ae6b 100644 > --- a/drivers/vhost/Kconfig > +++ b/drivers/vhost/Kconfig > @@ -35,6 +35,7 @@ config VHOST > > config VHOST_CROSS_ENDIAN_LEGACY > bool "Cross-endian support for vhost" > + depends on KVM_CROSS_ENDIAN_GUESTS > default n > ---help--- > This option allows vhost to support guests with a different byte > diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig > index e2c876d..cc7b28a 100644 > --- a/virt/kvm/Kconfig > +++ b/virt/kvm/Kconfig > @@ -47,3 +47,6 @@ config KVM_GENERIC_DIRTYLOG_READ_PROTECT > config KVM_COMPAT > def_bool y > depends on COMPAT && !S390 > + > +config KVM_CROSS_ENDIAN_GUESTS > + bool >
Christoffer Dall
2015-Jul-09 10:02 UTC
[PATCH] KVM: Add Kconfig option to signal cross-endian guests
On Thu, Jul 09, 2015 at 09:49:05AM +0200, Thomas Huth wrote:> The option for supporting cross-endianness legacy guests in > the vhost and tun code should only be available on systems > that support cross-endian guests. > > Signed-off-by: Thomas Huth <thuth at redhat.com>Acked-by: Christoffer Dall <christoffer.dall at linaro.org>
Cornelia Huck
2015-Jul-09 12:21 UTC
[PATCH] KVM: Add Kconfig option to signal cross-endian guests
On Thu, 9 Jul 2015 09:49:05 +0200 Thomas Huth <thuth at redhat.com> wrote:> The option for supporting cross-endianness legacy guests ins/cross-endianness/cross-endian/ ?> the vhost and tun code should only be available on systems > that support cross-endian guests. > > Signed-off-by: Thomas Huth <thuth at redhat.com> > --- > arch/arm/kvm/Kconfig | 1 + > arch/arm64/kvm/Kconfig | 1 + > arch/powerpc/kvm/Kconfig | 1 + > drivers/net/Kconfig | 1 + > drivers/vhost/Kconfig | 1 + > virt/kvm/Kconfig | 3 +++ > 6 files changed, 8 insertions(+)Acked-by: Cornelia Huck <cornelia.huck at de.ibm.com>
Greg Kurz
2015-Jul-13 09:24 UTC
[PATCH] KVM: Add Kconfig option to signal cross-endian guests
On Thu, 9 Jul 2015 09:49:05 +0200 Thomas Huth <thuth at redhat.com> wrote:> The option for supporting cross-endianness legacy guests in > the vhost and tun code should only be available on systems > that support cross-endian guests. > > Signed-off-by: Thomas Huth <thuth at redhat.com>Acked-by: Greg Kurz <gkurz at linux.vnet.ibm.com>
Possibly Parallel Threads
- [PATCH] KVM: Add Kconfig option to signal cross-endian guests
- [PULL] virtio/vhost: cross endian support
- [PULL] virtio/vhost: cross endian support
- [PATCH] KVM: Add Kconfig option to signal cross-endian guests
- [PATCH] KVM: Add Kconfig option to signal cross-endian guests