qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-6.2? 0/2] hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector
@ 2021-11-15 22:36 Philippe Mathieu-Daudé
  2021-11-15 22:36 ` [PATCH-for-6.2? 1/2] hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-11-15 22:36 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Miroslav Rezanina, qemu-arm,
	Philippe Mathieu-Daudé,
	Shashi Mallela

The GICv3 ITS support has been introduced uring the 6.2 development
window (commits 18f6290a6a9..17fb5e36aab). This device is for
emulation. When building virtualization-only binary, it might be
desirable to not include this device.

Introduce the CONFIG_ARM_GIC_TCG Kconfig selector to allow downstream
distributions to deselect this device.

Based-on: pull-target-arm-20211115-1

Philippe Mathieu-Daudé (2):
  hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c
  hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector

 hw/intc/arm_gicv3.c              |  2 +-
 hw/intc/arm_gicv3_cpuif.c        | 10 +---------
 hw/intc/arm_gicv3_cpuif_common.c | 22 ++++++++++++++++++++++
 hw/intc/Kconfig                  |  5 +++++
 hw/intc/meson.build              | 11 +++++++----
 5 files changed, 36 insertions(+), 14 deletions(-)
 create mode 100644 hw/intc/arm_gicv3_cpuif_common.c

-- 
2.31.1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH-for-6.2? 1/2] hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c
  2021-11-15 22:36 [PATCH-for-6.2? 0/2] hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector Philippe Mathieu-Daudé
@ 2021-11-15 22:36 ` Philippe Mathieu-Daudé
  2021-11-15 22:36 ` [PATCH-for-6.2? 2/2] hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector Philippe Mathieu-Daudé
  2021-11-22 10:59 ` [PATCH-for-6.2? 0/2] " Peter Maydell
  2 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-11-15 22:36 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Miroslav Rezanina, qemu-arm,
	Philippe Mathieu-Daudé,
	Shashi Mallela

gicv3_set_gicv3state() is used by arm_gicv3_common.c in
arm_gicv3_common_realize(). Since we want to restrict
arm_gicv3_cpuif.c to TCG, extract gicv3_set_gicv3state()
to a new file. Add this file to the meson 'specific'
source set, since it needs access to "cpu.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/intc/arm_gicv3_cpuif.c        | 10 +---------
 hw/intc/arm_gicv3_cpuif_common.c | 22 ++++++++++++++++++++++
 hw/intc/meson.build              |  1 +
 3 files changed, 24 insertions(+), 9 deletions(-)
 create mode 100644 hw/intc/arm_gicv3_cpuif_common.c

diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
index 3fe5de8ad7d..5e539e3b5ef 100644
--- a/hw/intc/arm_gicv3_cpuif.c
+++ b/hw/intc/arm_gicv3_cpuif.c
@@ -1,5 +1,5 @@
 /*
- * ARM Generic Interrupt Controller v3
+ * ARM Generic Interrupt Controller v3 (emulation)
  *
  * Copyright (c) 2016 Linaro Limited
  * Written by Peter Maydell
@@ -21,14 +21,6 @@
 #include "hw/irq.h"
 #include "cpu.h"
 
-void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s)
-{
-    ARMCPU *arm_cpu = ARM_CPU(cpu);
-    CPUARMState *env = &arm_cpu->env;
-
-    env->gicv3state = (void *)s;
-};
-
 static GICv3CPUState *icc_cs_from_env(CPUARMState *env)
 {
     return env->gicv3state;
diff --git a/hw/intc/arm_gicv3_cpuif_common.c b/hw/intc/arm_gicv3_cpuif_common.c
new file mode 100644
index 00000000000..ff1239f65db
--- /dev/null
+++ b/hw/intc/arm_gicv3_cpuif_common.c
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * ARM Generic Interrupt Controller v3
+ *
+ * Copyright (c) 2016 Linaro Limited
+ * Written by Peter Maydell
+ *
+ * This code is licensed under the GPL, version 2 or (at your option)
+ * any later version.
+ */
+
+#include "qemu/osdep.h"
+#include "gicv3_internal.h"
+#include "cpu.h"
+
+void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s)
+{
+    ARMCPU *arm_cpu = ARM_CPU(cpu);
+    CPUARMState *env = &arm_cpu->env;
+
+    env->gicv3state = (void *)s;
+};
diff --git a/hw/intc/meson.build b/hw/intc/meson.build
index c89d2ca180e..11352806db2 100644
--- a/hw/intc/meson.build
+++ b/hw/intc/meson.build
@@ -25,6 +25,7 @@
 
 specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c'))
 specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c'))
+specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c'))
 specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c'))
 specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'))
 specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH-for-6.2? 2/2] hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector
  2021-11-15 22:36 [PATCH-for-6.2? 0/2] hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector Philippe Mathieu-Daudé
  2021-11-15 22:36 ` [PATCH-for-6.2? 1/2] hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c Philippe Mathieu-Daudé
@ 2021-11-15 22:36 ` Philippe Mathieu-Daudé
  2021-11-22 10:59 ` [PATCH-for-6.2? 0/2] " Peter Maydell
  2 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-11-15 22:36 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Miroslav Rezanina, qemu-arm,
	Philippe Mathieu-Daudé,
	Shashi Mallela

The TYPE_ARM_GICV3 device is an emulated one.  When using
KVM, it is recommended to use the TYPE_KVM_ARM_GICV3 device
(which uses in-kernel support).

When using --with-devices-FOO, it is possible to build a
binary with a specific set of devices. When this binary is
restricted to KVM accelerator, the TYPE_ARM_GICV3 device is
irrelevant, and it is desirable to remove it from the binary.

Therefore introduce the CONFIG_ARM_GIC_TCG Kconfig selector
which select the files required to have the TYPE_ARM_GICV3
device, but also allowing to de-select this device.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/intc/arm_gicv3.c |  2 +-
 hw/intc/Kconfig     |  5 +++++
 hw/intc/meson.build | 10 ++++++----
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c
index c6282984b1e..76950c6f724 100644
--- a/hw/intc/arm_gicv3.c
+++ b/hw/intc/arm_gicv3.c
@@ -1,5 +1,5 @@
 /*
- * ARM Generic Interrupt Controller v3
+ * ARM Generic Interrupt Controller v3 (emulation)
  *
  * Copyright (c) 2015 Huawei.
  * Copyright (c) 2016 Linaro Limited
diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig
index 78aed93c454..010ded7eae0 100644
--- a/hw/intc/Kconfig
+++ b/hw/intc/Kconfig
@@ -25,6 +25,11 @@ config APIC
     select MSI_NONBROKEN
     select I8259
 
+config ARM_GIC_TCG
+    bool
+    default y
+    depends on ARM_GIC && TCG
+
 config ARM_GIC_KVM
     bool
     default y
diff --git a/hw/intc/meson.build b/hw/intc/meson.build
index 11352806db2..70080bc161c 100644
--- a/hw/intc/meson.build
+++ b/hw/intc/meson.build
@@ -3,12 +3,14 @@
   'arm_gic.c',
   'arm_gic_common.c',
   'arm_gicv2m.c',
-  'arm_gicv3.c',
   'arm_gicv3_common.c',
-  'arm_gicv3_dist.c',
   'arm_gicv3_its_common.c',
-  'arm_gicv3_redist.c',
+))
+softmmu_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files(
+  'arm_gicv3.c',
+  'arm_gicv3_dist.c',
   'arm_gicv3_its.c',
+  'arm_gicv3_redist.c',
 ))
 softmmu_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_pic.c'))
 softmmu_ss.add(when: 'CONFIG_HEATHROW_PIC', if_true: files('heathrow_pic.c'))
@@ -26,7 +28,7 @@
 specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c'))
 specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c'))
 specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c'))
-specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c'))
+specific_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files('arm_gicv3_cpuif.c'))
 specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'))
 specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
 specific_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c'))
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH-for-6.2? 0/2] hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector
  2021-11-15 22:36 [PATCH-for-6.2? 0/2] hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector Philippe Mathieu-Daudé
  2021-11-15 22:36 ` [PATCH-for-6.2? 1/2] hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c Philippe Mathieu-Daudé
  2021-11-15 22:36 ` [PATCH-for-6.2? 2/2] hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector Philippe Mathieu-Daudé
@ 2021-11-22 10:59 ` Peter Maydell
  2021-11-22 12:04   ` Philippe Mathieu-Daudé
  2 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2021-11-22 10:59 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Miroslav Rezanina, qemu-arm, qemu-devel, Shashi Mallela

On Mon, 15 Nov 2021 at 22:36, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> The GICv3 ITS support has been introduced uring the 6.2 development
> window (commits 18f6290a6a9..17fb5e36aab). This device is for
> emulation. When building virtualization-only binary, it might be
> desirable to not include this device.
>
> Introduce the CONFIG_ARM_GIC_TCG Kconfig selector to allow downstream
> distributions to deselect this device.
>
> Based-on: pull-target-arm-20211115-1
>
> Philippe Mathieu-Daudé (2):
>   hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c
>   hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

This looks OK to me, but I'm inclined to leave it for 7.0 at this
point in the release cycle, unless it would be awkward for
downstreams if we didn't put it in ?

thanks
-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH-for-6.2? 0/2] hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector
  2021-11-22 10:59 ` [PATCH-for-6.2? 0/2] " Peter Maydell
@ 2021-11-22 12:04   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-11-22 12:04 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Miroslav Rezanina, qemu-arm, qemu-devel, Shashi Mallela

On 11/22/21 11:59, Peter Maydell wrote:
> On Mon, 15 Nov 2021 at 22:36, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>
>> The GICv3 ITS support has been introduced uring the 6.2 development
>> window (commits 18f6290a6a9..17fb5e36aab). This device is for
>> emulation. When building virtualization-only binary, it might be
>> desirable to not include this device.
>>
>> Introduce the CONFIG_ARM_GIC_TCG Kconfig selector to allow downstream
>> distributions to deselect this device.
>>
>> Based-on: pull-target-arm-20211115-1
>>
>> Philippe Mathieu-Daudé (2):
>>   hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c
>>   hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> This looks OK to me, but I'm inclined to leave it for 7.0 at this
> point in the release cycle, unless it would be awkward for
> downstreams if we didn't put it in ?

Mirek was Cc'ed and didn't comment so let's delay it to 7.0.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-22 12:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 22:36 [PATCH-for-6.2? 0/2] hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector Philippe Mathieu-Daudé
2021-11-15 22:36 ` [PATCH-for-6.2? 1/2] hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c Philippe Mathieu-Daudé
2021-11-15 22:36 ` [PATCH-for-6.2? 2/2] hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector Philippe Mathieu-Daudé
2021-11-22 10:59 ` [PATCH-for-6.2? 0/2] " Peter Maydell
2021-11-22 12:04   ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).