diff mbox series

[3/4] RFC target/arm: Do not build pre-ARMv7 cpus when using KVM

Message ID 20190823135811.13883-4-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series Support disabling TCG on ARM (part 2) | expand

Commit Message

Philippe Mathieu-Daudé Aug. 23, 2019, 1:58 p.m. UTC
A KVM-only build won't be able to run pre-ARMv7 cpus, disable them.

If KVM is not enabled, they are enabled by default.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Sadly this does not work with --enable-tcg --enable-kvm dual config.
---
 default-configs/arm-softmmu.mak | 33 ++++++++++++++++-----------------
 hw/arm/Kconfig                  | 26 ++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 17 deletions(-)

Comments

Thomas Huth Aug. 23, 2019, 2:28 p.m. UTC | #1
On 8/23/19 3:58 PM, Philippe Mathieu-Daudé wrote:
> A KVM-only build won't be able to run pre-ARMv7 cpus, disable them.
> 
> If KVM is not enabled, they are enabled by default.
[...]
>  config CHEETAH
>      bool
> +    select ARM_V4
>      select OMAP
>      select TSC210X

Are you sure about the "enabled by default" ? There is not "default y"
here, is it?

Also I'm not sure whether it's such a good idea to always disable the
config switches in default-configs/arm-softmmu.mak ... if somebody wants
to build such a restricted QEMU, don't they have to maintain their own
set of config files anyway?

I think we should maybe rather rework the default-configs directory:
Rename the default to "config/default/" instead and then we can add
other subfolders with such special configurations, e.g. config/nemu/ or
config/lean-kvm/ or however you want to call it. Then add a new switch
to the configure script to be able to use the configs from such a
different folder.

 Thomas
Richard Henderson Aug. 23, 2019, 5:12 p.m. UTC | #2
On 8/23/19 6:58 AM, Philippe Mathieu-Daudé wrote:
> A KVM-only build won't be able to run pre-ARMv7 cpus, disable them.
> 
> If KVM is not enabled, they are enabled by default.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Sadly this does not work with --enable-tcg --enable-kvm dual config.
> ---

Huh?  --enable-kvm does not imply --disable-tcg.

> +config ARM_V4
> +    default y
> +    depends on !KVM
> +    bool

This should surely be "depends on TCG".


r~
Philippe Mathieu-Daudé Aug. 29, 2019, 6:08 p.m. UTC | #3
On 8/23/19 7:12 PM, Richard Henderson wrote:
> On 8/23/19 6:58 AM, Philippe Mathieu-Daudé wrote:
>> A KVM-only build won't be able to run pre-ARMv7 cpus, disable them.
>>
>> If KVM is not enabled, they are enabled by default.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> Sadly this does not work with --enable-tcg --enable-kvm dual config.
>> ---
> 
> Huh?  --enable-kvm does not imply --disable-tcg.

That would have made my life easier ;)

>> +config ARM_V4
>> +    default y
>> +    depends on !KVM
>> +    bool
> 
> This should surely be "depends on TCG".

I restricted this to KVM because this is the only one I know and got
confirmation by Peter. I don't know about other accelerators but I'll
happily take your suggestion!

Thanks,

Phil.
Philippe Mathieu-Daudé Aug. 29, 2019, 6:19 p.m. UTC | #4
Hi Thomas,

On 8/23/19 4:28 PM, Thomas Huth wrote:
> On 8/23/19 3:58 PM, Philippe Mathieu-Daudé wrote:
>> A KVM-only build won't be able to run pre-ARMv7 cpus, disable them.
>>
>> If KVM is not enabled, they are enabled by default.
> [...]
>>  config CHEETAH
>>      bool
>> +    select ARM_V4
>>      select OMAP
>>      select TSC210X
> 
> Are you sure about the "enabled by default" ? There is not "default y"
> here, is it?

What I mean is if you build with --disable-kvm, this selects
--enable-tcg which provides the pre-ARMv7 cpus. So to make no changes, I
also added:

  config ARM_V4
      default y

Which include the "default y".

> 
> Also I'm not sure whether it's such a good idea to always disable the
> config switches in default-configs/arm-softmmu.mak ... if somebody wants
> to build such a restricted QEMU, don't they have to maintain their own
> set of config files anyway?

Ah... I followed your example:

$ git show 9e5c2056d1e
commit 9e5c2056d1e80f344a0c412d7a3d847db1f4e034
Author: Thomas Huth <thuth@redhat.com>
Date:   Tue Jan 29 10:42:14 2019 +0100

    s390x: express dependencies with Kconfig

    Instead of hard-coding all config switches in the config file
    default-configs/s390x-softmmu.mak, let's use the new Kconfig files
    to express the necessary dependencies: The S390_CCW_VIRTIO config switch
    for the "s390-ccw-virtio" machine now selects all non-optional devices.

    And since we already have the VIRTIO_PCI and VIRTIO_MMIO config switches
    for the other two virtio transports, this patch also introduces a new
    config switch VIRTIO_CCW for the third, s390x-specific virtio transport,
    so that all three virtio transports are now handled in the same way.

diff --git a/default-configs/s390x-softmmu.mak
b/default-configs/s390x-softmmu.mak
@@ -1,9 +1,13 @@
-CONFIG_PCI=y
-CONFIG_VIRTIO_PCI=y
-CONFIG_SCLPCONSOLE=y
-CONFIG_TERMINAL3270=y
-CONFIG_S390_FLIC=y
-CONFIG_WDT_DIAG288=y
+# Default configuration for s390x-softmmu
+
+# Uncomment the following lines to disable these optional devices:
+#
+#CONFIG_TERMINAL3270=n
+#CONFIG_VFIO_AP=n
+#CONFIG_VFIO_CCW=n
+#CONFIG_VIRTIO_PCI=n
+#CONFIG_WDT_DIAG288=n
+
+# Boards:
+#
 CONFIG_S390_CCW_VIRTIO=y
-CONFIG_VFIO_CCW=y
-CONFIG_VFIO_AP=y

OK now I see, I should have added your comment and use the opposite form
(because now these boards are all enabled) so 's/=y/=n' in my patch.

> I think we should maybe rather rework the default-configs directory:
> Rename the default to "config/default/" instead and then we can add
> other subfolders with such special configurations, e.g. config/nemu/ or
> config/lean-kvm/ or however you want to call it. Then add a new switch
> to the configure script to be able to use the configs from such a
> different folder.

OK so if someone wants a special config, he'd know the config values to
select, so it is pointless/confusing to keep them commented.
Are you suggesting to simply remove the default entries? Such:

-- >8 --
@@ -9,34 +9,33 @@ CONFIG_ARM_V7M=y
 CONFIG_ARM_VIRT=y
 CONFIG_CUBIEBOARD=y
 CONFIG_EXYNOS4=y
-CONFIG_HIGHBANK=y
-CONFIG_INTEGRATOR=y
 CONFIG_FSL_IMX31=y
-CONFIG_MUSICPAL=y
 CONFIG_MUSCA=y
-CONFIG_CHEETAH=y
-CONFIG_SX1=y
-CONFIG_NSERIES=y
 CONFIG_STELLARIS=y
 CONFIG_REALVIEW=y
-CONFIG_VERSATILE=y
 CONFIG_VEXPRESS=y
 CONFIG_ZYNQ=y
-CONFIG_MAINSTONE=y
-CONFIG_GUMSTIX=y
-CONFIG_SPITZ=y
-CONFIG_TOSA=y
-CONFIG_Z2=y
-CONFIG_COLLIE=y
-CONFIG_ASPEED_SOC=y
 CONFIG_NETDUINO2=y
 CONFIG_MPS2=y
 CONFIG_RASPI=y
-CONFIG_DIGIC=y
 CONFIG_SABRELITE=y
 CONFIG_EMCRAFT_SF2=y
-CONFIG_MICROBIT=y
-CONFIG_FSL_IMX25=y
 CONFIG_FSL_IMX7=y
 CONFIG_FSL_IMX6UL=y
 CONFIG_SEMIHOSTING=y
---

Thanks,

Phil.
Thomas Huth Aug. 30, 2019, 5:35 a.m. UTC | #5
On 29/08/2019 20.19, Philippe Mathieu-Daudé wrote:
> Hi Thomas,
> 
> On 8/23/19 4:28 PM, Thomas Huth wrote:
>> On 8/23/19 3:58 PM, Philippe Mathieu-Daudé wrote:
>>> A KVM-only build won't be able to run pre-ARMv7 cpus, disable them.
>>>
>>> If KVM is not enabled, they are enabled by default.
>> [...]
>>>  config CHEETAH
>>>      bool
>>> +    select ARM_V4
>>>      select OMAP
>>>      select TSC210X
>>
>> Are you sure about the "enabled by default" ? There is not "default y"
>> here, is it?
> 
> What I mean is if you build with --disable-kvm, this selects
> --enable-tcg which provides the pre-ARMv7 cpus. So to make no changes, I
> also added:
> 
>   config ARM_V4
>       default y
> 
> Which include the "default y".

Well, so the ARM_V4 config switch is enabled by default. But where is
the CHEETAH config switch enabled now?

>> I think we should maybe rather rework the default-configs directory:
>> Rename the default to "config/default/" instead and then we can add
>> other subfolders with such special configurations, e.g. config/nemu/ or
>> config/lean-kvm/ or however you want to call it. Then add a new switch
>> to the configure script to be able to use the configs from such a
>> different folder.
> 
> OK so if someone wants a special config, he'd know the config values to
> select, so it is pointless/confusing to keep them commented.
> Are you suggesting to simply remove the default entries?
Certainly not! I meant to keep the current file (with everything
enabled) in config/default/, and to add another config file to
config/lean-kvm/ where the TCG-only boards are disabled. Then the user
can easily run "./configure --build-config-dir=config/lean-kvm/" to
enable these settings.

 Thomas
diff mbox series

Patch

diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
index 1f2e0e7fde..081d507c87 100644
--- a/default-configs/arm-softmmu.mak
+++ b/default-configs/arm-softmmu.mak
@@ -9,34 +9,33 @@  CONFIG_ARM_V7M=y
 CONFIG_ARM_VIRT=y
 CONFIG_CUBIEBOARD=y
 CONFIG_EXYNOS4=y
-CONFIG_HIGHBANK=y
-CONFIG_INTEGRATOR=y
 CONFIG_FSL_IMX31=y
-CONFIG_MUSICPAL=y
 CONFIG_MUSCA=y
-CONFIG_CHEETAH=y
-CONFIG_SX1=y
-CONFIG_NSERIES=y
 CONFIG_STELLARIS=y
 CONFIG_REALVIEW=y
-CONFIG_VERSATILE=y
 CONFIG_VEXPRESS=y
 CONFIG_ZYNQ=y
-CONFIG_MAINSTONE=y
-CONFIG_GUMSTIX=y
-CONFIG_SPITZ=y
-CONFIG_TOSA=y
-CONFIG_Z2=y
-CONFIG_COLLIE=y
-CONFIG_ASPEED_SOC=y
 CONFIG_NETDUINO2=y
 CONFIG_MPS2=y
 CONFIG_RASPI=y
-CONFIG_DIGIC=y
 CONFIG_SABRELITE=y
 CONFIG_EMCRAFT_SF2=y
-CONFIG_MICROBIT=y
-CONFIG_FSL_IMX25=y
 CONFIG_FSL_IMX7=y
 CONFIG_FSL_IMX6UL=y
 CONFIG_SEMIHOSTING=y
+#CONFIG_CHEETAH=y
+#CONFIG_SX1=y
+#CONFIG_DIGIC=y
+#CONFIG_INTEGRATOR=y
+#CONFIG_MUSICPAL=y
+#CONFIG_MAINSTONE=y
+#CONFIG_GUMSTIX=y
+#CONFIG_SPITZ=y
+#CONFIG_TOSA=y
+#CONFIG_COLLIE=y
+#CONFIG_VERSATILE=y
+#CONFIG_FSL_IMX25=y
+#CONFIG_ASPEED_SOC=y
+#CONFIG_NSERIES=y
+#CONFIG_HIGHBANK=n
+#CONFIG_MICROBIT=n
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
index 76a2a6bcbf..902cceca7e 100644
--- a/hw/arm/Kconfig
+++ b/hw/arm/Kconfig
@@ -1,3 +1,18 @@ 
+config ARM_V4
+    default y
+    depends on !KVM
+    bool
+
+config ARM_V5
+    default y
+    depends on !KVM
+    bool
+
+config ARM_V6
+    default y
+    depends on !KVM
+    bool
+
 config ARM_VIRT
     bool
     imply PCI_DEVICES
@@ -23,6 +38,7 @@  config ARM_VIRT
 
 config CHEETAH
     bool
+    select ARM_V4
     select OMAP
     select TSC210X
 
@@ -32,6 +48,7 @@  config CUBIEBOARD
 
 config DIGIC
     bool
+    select ARM_V5
     select PTIMER
     select PFLASH_CFI02
 
@@ -61,6 +78,7 @@  config HIGHBANK
 
 config INTEGRATOR
     bool
+    select ARM_V5
     select ARM_TIMER
     select INTEGRATOR_DEBUG
     select PL011 # UART
@@ -86,6 +104,7 @@  config MUSCA
 
 config MUSICPAL
     bool
+    select ARM_V5
     select BITBANG_I2C
     select MARVELL_88W8618
     select PTIMER
@@ -99,6 +118,7 @@  config NETDUINO2
 
 config NSERIES
     bool
+    select ARM_V6
     select OMAP
     select TMP105   # tempature sensor
     select BLIZZARD # LCD/TV controller
@@ -121,6 +141,7 @@  config OMAP
 
 config PXA2XX
     bool
+    select ARM_V5
     select FRAMEBUFFER
     select I2C
     select SERIAL
@@ -232,10 +253,12 @@  config COLLIE
 
 config SX1
     bool
+    select ARM_V4
     select OMAP
 
 config VERSATILE
     bool
+    select ARM_V5
     select ARM_TIMER # sp804
     select PFLASH_CFI01
     select LSI_SCSI_PCI
@@ -327,6 +350,7 @@  config XLNX_VERSAL
 
 config FSL_IMX25
     bool
+    select ARM_V5
     select IMX
     select IMX_FEC
     select IMX_I2C
@@ -334,6 +358,7 @@  config FSL_IMX25
 
 config FSL_IMX31
     bool
+    select ARM_V6
     select SERIAL
     select IMX
     select IMX_I2C
@@ -349,6 +374,7 @@  config FSL_IMX6
 
 config ASPEED_SOC
     bool
+    select ARM_V5
     select DS1338
     select FTGMAC100
     select I2C