All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v4 0/7] Poison some more target-specific defines
@ 2017-06-26  5:22 Thomas Huth
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 1/7] include/exec/poison: Add some more missing TARGET and CONFIG defines Thomas Huth
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Thomas Huth @ 2017-06-26  5:22 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini

This series marks some more #defines as poisoned, which are
target-specific (declared in config-target.h) and thus must
not be used in common code.

v4:
- Rebased to master since the v2 versions of the first two patches
  have already been merged. The diff between v2 and v3 can now be
  found in the first patch of this series.

v3:
- Mark some more TARGET_xxx and CONFIG_xxx defines as poisoned in
  the first two patches (as requested by Richard)
- Added the final patch to move the edu device to common-obj-y

v2:
- First two patches are the same as in v1
- Reworked the CONFIG_KVM patches according to Paolo's review feedback
- Added two new patches to finally poison CONFIG_SOFTMMU, too
- Added a final patch to move bootdevice.o to common-obj now
  (based on an earlier patch where I also tried to move numa.o and
  balloon.o, too - but these files are indirectly target-dependent as
  I now know, so they can't be moved)

Thomas Huth (7):
  include/exec/poison: Add some more missing TARGET and CONFIG defines
  Move CONFIG_KVM related definitions to kvm_i386.h
  include/exec/poison: Mark CONFIG_KVM as poisoned, too
  cpu: Introduce a wrapper for tlb_flush() that can be used in common
    code
  include/exec/poison: Mark CONFIG_SOFTMMU as poisoned
  Makefile: Move bootdevice.o to common-obj-y
  hw/misc/edu: Compile the edu device as common object

 Makefile.objs             |  2 +-
 Makefile.target           |  2 +-
 accel/tcg/translate-all.c |  8 ++++++++
 bootdevice.c              |  2 +-
 hw/acpi/ich9.c            |  1 -
 hw/i386/pc_q35.c          |  1 +
 hw/misc/Makefile.objs     |  2 +-
 include/exec/cpu-common.h |  2 ++
 include/exec/poison.h     |  8 ++++++++
 include/hw/i386/pc.h      | 13 -------------
 include/qom/cpu.h         |  8 ++++++++
 include/sysemu/kvm.h      | 31 ++++++++++++-------------------
 qom/cpu.c                 |  5 ++---
 target/i386/kvm_i386.h    | 23 +++++++++++++++++++++++
 14 files changed, 68 insertions(+), 40 deletions(-)

-- 
1.8.3.1

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

* [Qemu-devel] [PATCH v4 1/7] include/exec/poison: Add some more missing TARGET and CONFIG defines
  2017-06-26  5:22 [Qemu-devel] [PATCH v4 0/7] Poison some more target-specific defines Thomas Huth
@ 2017-06-26  5:22 ` Thomas Huth
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 2/7] Move CONFIG_KVM related definitions to kvm_i386.h Thomas Huth
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2017-06-26  5:22 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini

The defines of some *-linux-user targets were still missing.

Suggested-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 include/exec/poison.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/exec/poison.h b/include/exec/poison.h
index 5ffed4d..7a025b2 100644
--- a/include/exec/poison.h
+++ b/include/exec/poison.h
@@ -7,13 +7,16 @@
 
 #pragma GCC poison TARGET_I386
 #pragma GCC poison TARGET_X86_64
+#pragma GCC poison TARGET_AARCH64
 #pragma GCC poison TARGET_ALPHA
 #pragma GCC poison TARGET_ARM
 #pragma GCC poison TARGET_CRIS
+#pragma GCC poison TARGET_HPPA
 #pragma GCC poison TARGET_LM32
 #pragma GCC poison TARGET_M68K
 #pragma GCC poison TARGET_MICROBLAZE
 #pragma GCC poison TARGET_MIPS
+#pragma GCC poison TARGET_ABI_MIPSN32
 #pragma GCC poison TARGET_ABI_MIPSO32
 #pragma GCC poison TARGET_MIPS64
 #pragma GCC poison TARGET_ABI_MIPSN64
@@ -28,10 +31,12 @@
 #pragma GCC poison TARGET_SH4
 #pragma GCC poison TARGET_SPARC
 #pragma GCC poison TARGET_SPARC64
+#pragma GCC poison TARGET_TILEGX
 #pragma GCC poison TARGET_TRICORE
 #pragma GCC poison TARGET_UNICORE32
 #pragma GCC poison TARGET_XTENSA
 
+#pragma GCC poison TARGET_HAS_BFLT
 #pragma GCC poison TARGET_NAME
 #pragma GCC poison TARGET_SUPPORTS_MTTCG
 #pragma GCC poison TARGET_WORDS_BIGENDIAN
@@ -65,6 +70,7 @@
 #pragma GCC poison CONFIG_ARM_A64_DIS
 #pragma GCC poison CONFIG_ARM_DIS
 #pragma GCC poison CONFIG_CRIS_DIS
+#pragma GCC poison CONFIG_HPPA_DIS
 #pragma GCC poison CONFIG_I386_DIS
 #pragma GCC poison CONFIG_LM32_DIS
 #pragma GCC poison CONFIG_M68K_DIS
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH v4 2/7] Move CONFIG_KVM related definitions to kvm_i386.h
  2017-06-26  5:22 [Qemu-devel] [PATCH v4 0/7] Poison some more target-specific defines Thomas Huth
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 1/7] include/exec/poison: Add some more missing TARGET and CONFIG defines Thomas Huth
@ 2017-06-26  5:22 ` Thomas Huth
  2017-06-26 11:12   ` Philippe Mathieu-Daudé
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 3/7] include/exec/poison: Mark CONFIG_KVM as poisoned, too Thomas Huth
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Thomas Huth @ 2017-06-26  5:22 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini

pc.h and sysemu/kvm.h are also included from common code (where
CONFIG_KVM is not available), so the #defines that depend on CONFIG_KVM
should not be declared here to avoid that anybody is using them in a
wrong way. Since we're also going to poison CONFIG_KVM for common code,
let's move them to kvm_i386.h instead. Most of the dummy definitions
from sysemu/kvm.h are also unused since the code that uses them is
only compiled for CONFIG_KVM (e.g. target/i386/kvm.c), so the unused
defines are also simply dropped here instead of being moved.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/i386/pc_q35.c       |  1 +
 include/hw/i386/pc.h   | 13 -------------
 include/sysemu/kvm.h   | 15 ---------------
 target/i386/kvm_i386.h | 23 +++++++++++++++++++++++
 4 files changed, 24 insertions(+), 28 deletions(-)

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 1523ef3..8f696b7 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -36,6 +36,7 @@
 #include "hw/timer/mc146818rtc.h"
 #include "hw/xen/xen.h"
 #include "sysemu/kvm.h"
+#include "kvm_i386.h"
 #include "hw/kvm/clock.h"
 #include "hw/pci-host/q35.h"
 #include "exec/address-spaces.h"
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 233216a..f48d167 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -20,19 +20,6 @@
 
 #define HPET_INTCAP "hpet-intcap"
 
-#ifdef CONFIG_KVM
-#define kvm_pit_in_kernel() \
-    (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
-#define kvm_pic_in_kernel()  \
-    (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
-#define kvm_ioapic_in_kernel() \
-    (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
-#else
-#define kvm_pit_in_kernel()      0
-#define kvm_pic_in_kernel()      0
-#define kvm_ioapic_in_kernel()   0
-#endif
-
 /**
  * PCMachineState:
  * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 1e91613..ca40b6e 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -22,21 +22,6 @@
 #ifdef CONFIG_KVM
 #include <linux/kvm.h>
 #include <linux/kvm_para.h>
-#else
-/* These constants must never be used at runtime if kvm_enabled() is false.
- * They exist so we don't need #ifdefs around KVM-specific code that already
- * checks kvm_enabled() properly.
- */
-#define KVM_CPUID_SIGNATURE      0
-#define KVM_CPUID_FEATURES       0
-#define KVM_FEATURE_CLOCKSOURCE  0
-#define KVM_FEATURE_NOP_IO_DELAY 0
-#define KVM_FEATURE_MMU_OP       0
-#define KVM_FEATURE_CLOCKSOURCE2 0
-#define KVM_FEATURE_ASYNC_PF     0
-#define KVM_FEATURE_STEAL_TIME   0
-#define KVM_FEATURE_PV_EOI       0
-#define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 0
 #endif
 
 extern bool kvm_allowed;
diff --git a/target/i386/kvm_i386.h b/target/i386/kvm_i386.h
index bfce427..1de9876 100644
--- a/target/i386/kvm_i386.h
+++ b/target/i386/kvm_i386.h
@@ -15,6 +15,29 @@
 
 #define kvm_apic_in_kernel() (kvm_irqchip_in_kernel())
 
+#ifdef CONFIG_KVM
+
+#define kvm_pit_in_kernel() \
+    (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
+#define kvm_pic_in_kernel()  \
+    (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
+#define kvm_ioapic_in_kernel() \
+    (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
+
+#else
+
+#define kvm_pit_in_kernel()      0
+#define kvm_pic_in_kernel()      0
+#define kvm_ioapic_in_kernel()   0
+
+/* These constants must never be used at runtime if kvm_enabled() is false.
+ * They exist so we don't need #ifdefs around KVM-specific code that already
+ * checks kvm_enabled() properly.
+ */
+#define KVM_CPUID_FEATURES       0
+
+#endif  /* CONFIG_KVM */
+
 bool kvm_allows_irq0_override(void);
 bool kvm_has_smm(void);
 bool kvm_has_adjust_clock_stable(void);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH v4 3/7] include/exec/poison: Mark CONFIG_KVM as poisoned, too
  2017-06-26  5:22 [Qemu-devel] [PATCH v4 0/7] Poison some more target-specific defines Thomas Huth
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 1/7] include/exec/poison: Add some more missing TARGET and CONFIG defines Thomas Huth
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 2/7] Move CONFIG_KVM related definitions to kvm_i386.h Thomas Huth
@ 2017-06-26  5:22 ` Thomas Huth
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 4/7] cpu: Introduce a wrapper for tlb_flush() that can be used in common code Thomas Huth
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2017-06-26  5:22 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini

CONFIG_KVM is only defined for target-specific code, so nobody should
use it by accident in common code. To avoid such subtle bugs,
CONFIG_KVM is now marked as poisoned in common code. The header
include/sysemu/kvm.h is somewhat special since it is included
all over the place from common code, too, so we need some extra
logic via "#ifdef NEED_CPU_H" here to make sure that we can
compile all files without problems.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/acpi/ich9.c        |  1 -
 include/exec/poison.h |  1 +
 include/sysemu/kvm.h  | 18 +++++++++++++-----
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 5c279bb..c5d8646 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -33,7 +33,6 @@
 #include "sysemu/sysemu.h"
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/tco.h"
-#include "sysemu/kvm.h"
 #include "exec/address-spaces.h"
 
 #include "hw/i386/ich9.h"
diff --git a/include/exec/poison.h b/include/exec/poison.h
index 7a025b2..32707cd 100644
--- a/include/exec/poison.h
+++ b/include/exec/poison.h
@@ -86,6 +86,7 @@
 
 #pragma GCC poison CONFIG_LINUX_USER
 #pragma GCC poison CONFIG_VHOST_NET
+#pragma GCC poison CONFIG_KVM
 
 #endif
 #endif
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index ca40b6e..052e11f 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -19,11 +19,18 @@
 #include "exec/memattrs.h"
 #include "hw/irq.h"
 
-#ifdef CONFIG_KVM
-#include <linux/kvm.h>
-#include <linux/kvm_para.h>
+#ifdef NEED_CPU_H
+# ifdef CONFIG_KVM
+#  include <linux/kvm.h>
+#  include <linux/kvm_para.h>
+#  define CONFIG_KVM_IS_POSSIBLE
+# endif
+#else
+# define CONFIG_KVM_IS_POSSIBLE
 #endif
 
+#ifdef CONFIG_KVM_IS_POSSIBLE
+
 extern bool kvm_allowed;
 extern bool kvm_kernel_irqchip;
 extern bool kvm_split_irqchip;
@@ -40,7 +47,6 @@ extern bool kvm_direct_msi_allowed;
 extern bool kvm_ioeventfd_any_length_allowed;
 extern bool kvm_msi_use_devid;
 
-#if defined CONFIG_KVM || !defined NEED_CPU_H
 #define kvm_enabled()           (kvm_allowed)
 /**
  * kvm_irqchip_in_kernel:
@@ -163,6 +169,7 @@ extern bool kvm_msi_use_devid;
 #define kvm_msi_devid_required() (kvm_msi_use_devid)
 
 #else
+
 #define kvm_enabled()           (0)
 #define kvm_irqchip_in_kernel() (false)
 #define kvm_irqchip_is_split() (false)
@@ -178,7 +185,8 @@ extern bool kvm_msi_use_devid;
 #define kvm_direct_msi_enabled() (false)
 #define kvm_ioeventfd_any_length_enabled() (false)
 #define kvm_msi_devid_required() (false)
-#endif
+
+#endif  /* CONFIG_KVM_IS_POSSIBLE */
 
 struct kvm_run;
 struct kvm_lapic_state;
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH v4 4/7] cpu: Introduce a wrapper for tlb_flush() that can be used in common code
  2017-06-26  5:22 [Qemu-devel] [PATCH v4 0/7] Poison some more target-specific defines Thomas Huth
                   ` (2 preceding siblings ...)
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 3/7] include/exec/poison: Mark CONFIG_KVM as poisoned, too Thomas Huth
@ 2017-06-26  5:22 ` Thomas Huth
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 5/7] include/exec/poison: Mark CONFIG_SOFTMMU as poisoned Thomas Huth
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2017-06-26  5:22 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini

Commit 1f5c00cfdb8114c ("qom/cpu: move tlb_flush to cpu_common_reset")
moved the call to tlb_flush() from the target-specific reset handlers
into the common code qom/cpu.c file, and protected the call with
"#ifdef CONFIG_SOFTMMU" to avoid that it is called for linux-user
only targets. But since qom/cpu.c is common code, CONFIG_SOFTMMU is
*never* defined here, so the tlb_flush() was simply never executed
anymore. Fix it by introducing a wrapper for tlb_flush() in a file
that is re-compiled for each target, i.e. in translate-all.c.

Fixes: 1f5c00cfdb8114c1e3a13426588ceb64f82c9ddb
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 accel/tcg/translate-all.c | 8 ++++++++
 include/exec/cpu-common.h | 2 ++
 qom/cpu.c                 | 5 ++---
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index f6ad46b..a3f374e 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -2225,3 +2225,11 @@ int page_unprotect(target_ulong address, uintptr_t pc)
     return 0;
 }
 #endif /* CONFIG_USER_ONLY */
+
+/* This is a wrapper for common code that can not use CONFIG_SOFTMMU */
+void tcg_flush_softmmu_tlb(CPUState *cs)
+{
+#ifdef CONFIG_SOFTMMU
+    tlb_flush(cs);
+#endif
+}
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 4d45a72..74341b1 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -28,6 +28,8 @@ void qemu_init_cpu_list(void);
 void cpu_list_lock(void);
 void cpu_list_unlock(void);
 
+void tcg_flush_softmmu_tlb(CPUState *cs);
+
 #if !defined(CONFIG_USER_ONLY)
 
 enum device_endian {
diff --git a/qom/cpu.c b/qom/cpu.c
index 5069876..303eb42 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -26,6 +26,7 @@
 #include "qemu/notify.h"
 #include "qemu/log.h"
 #include "exec/log.h"
+#include "exec/cpu-common.h"
 #include "qemu/error-report.h"
 #include "sysemu/sysemu.h"
 #include "hw/qdev-properties.h"
@@ -296,9 +297,7 @@ static void cpu_common_reset(CPUState *cpu)
             atomic_set(&cpu->tb_jmp_cache[i], NULL);
         }
 
-#ifdef CONFIG_SOFTMMU
-        tlb_flush(cpu, 0);
-#endif
+        tcg_flush_softmmu_tlb(cpu);
     }
 }
 
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH v4 5/7] include/exec/poison: Mark CONFIG_SOFTMMU as poisoned
  2017-06-26  5:22 [Qemu-devel] [PATCH v4 0/7] Poison some more target-specific defines Thomas Huth
                   ` (3 preceding siblings ...)
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 4/7] cpu: Introduce a wrapper for tlb_flush() that can be used in common code Thomas Huth
@ 2017-06-26  5:22 ` Thomas Huth
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 6/7] Makefile: Move bootdevice.o to common-obj-y Thomas Huth
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 7/7] hw/misc/edu: Compile the edu device as common object Thomas Huth
  6 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2017-06-26  5:22 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini

CONFIG_SOFTMMU should never be used in common code, so mark
it as poisoned, too.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 include/exec/poison.h | 1 +
 include/qom/cpu.h     | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/include/exec/poison.h b/include/exec/poison.h
index 32707cd..41cd2eb 100644
--- a/include/exec/poison.h
+++ b/include/exec/poison.h
@@ -87,6 +87,7 @@
 #pragma GCC poison CONFIG_LINUX_USER
 #pragma GCC poison CONFIG_VHOST_NET
 #pragma GCC poison CONFIG_KVM
+#pragma GCC poison CONFIG_SOFTMMU
 
 #endif
 #endif
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 89ddb68..c41e1e3 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -783,6 +783,8 @@ bool cpu_throttle_active(void);
  */
 int cpu_throttle_get_percentage(void);
 
+#ifdef NEED_CPU_H
+
 #ifndef CONFIG_USER_ONLY
 
 typedef void (*CPUInterruptHandler)(CPUState *, int);
@@ -829,6 +831,8 @@ static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr,
 }
 #endif
 
+#endif /* NEED_CPU_H */
+
 /**
  * cpu_set_pc:
  * @cpu: The CPU to set the program counter for.
@@ -1005,6 +1009,8 @@ void cpu_exec_initfn(CPUState *cpu);
 void cpu_exec_realizefn(CPUState *cpu, Error **errp);
 void cpu_exec_unrealizefn(CPUState *cpu);
 
+#ifdef NEED_CPU_H
+
 #ifdef CONFIG_SOFTMMU
 extern const struct VMStateDescription vmstate_cpu_common;
 #else
@@ -1019,6 +1025,8 @@ extern const struct VMStateDescription vmstate_cpu_common;
     .offset = 0,                                                            \
 }
 
+#endif /* NEED_CPU_H */
+
 #define UNASSIGNED_CPU_INDEX -1
 
 #endif
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH v4 6/7] Makefile: Move bootdevice.o to common-obj-y
  2017-06-26  5:22 [Qemu-devel] [PATCH v4 0/7] Poison some more target-specific defines Thomas Huth
                   ` (4 preceding siblings ...)
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 5/7] include/exec/poison: Mark CONFIG_SOFTMMU as poisoned Thomas Huth
@ 2017-06-26  5:22 ` Thomas Huth
  2017-06-26 11:12   ` Philippe Mathieu-Daudé
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 7/7] hw/misc/edu: Compile the edu device as common object Thomas Huth
  6 siblings, 1 reply; 11+ messages in thread
From: Thomas Huth @ 2017-06-26  5:22 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini

There does not seem to be any target specific code in this file, so
we can put it into "common-obj" instead of "obj" to compile it only
once for all targets.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 Makefile.objs   | 2 +-
 Makefile.target | 2 +-
 bootdevice.c    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile.objs b/Makefile.objs
index b2e6322..756644c 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -40,7 +40,7 @@ io-obj-y = io/
 
 ifeq ($(CONFIG_SOFTMMU),y)
 common-obj-y = blockdev.o blockdev-nbd.o block/
-common-obj-y += iothread.o
+common-obj-y += bootdevice.o iothread.o
 common-obj-y += net/
 common-obj-y += qdev-monitor.o device-hotplug.o
 common-obj-$(CONFIG_WIN32) += os-win32.o
diff --git a/Makefile.target b/Makefile.target
index 0066579..ffa7a8f 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -137,7 +137,7 @@ endif #CONFIG_BSD_USER
 # System emulator target
 ifdef CONFIG_SOFTMMU
 obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o numa.o
-obj-y += qtest.o bootdevice.o
+obj-y += qtest.o
 obj-y += hw/
 obj-y += memory.o
 obj-y += memory_mapping.o
diff --git a/bootdevice.c b/bootdevice.c
index 33e3029..1141009 100644
--- a/bootdevice.c
+++ b/bootdevice.c
@@ -27,7 +27,7 @@
 #include "sysemu/sysemu.h"
 #include "qapi/visitor.h"
 #include "qemu/error-report.h"
-#include "hw/hw.h"
+#include "sysemu/reset.h"
 #include "hw/qdev-core.h"
 
 typedef struct FWBootEntry FWBootEntry;
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH v4 7/7] hw/misc/edu: Compile the edu device as common object
  2017-06-26  5:22 [Qemu-devel] [PATCH v4 0/7] Poison some more target-specific defines Thomas Huth
                   ` (5 preceding siblings ...)
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 6/7] Makefile: Move bootdevice.o to common-obj-y Thomas Huth
@ 2017-06-26  5:22 ` Thomas Huth
  2017-06-26 11:13   ` Philippe Mathieu-Daudé
  6 siblings, 1 reply; 11+ messages in thread
From: Thomas Huth @ 2017-06-26  5:22 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini

edu.c does not contain any target-specific code, so we can put
it into common-obj-y to compile it only once for all targets.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/misc/Makefile.objs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
index 2019846..7fc4e41 100644
--- a/hw/misc/Makefile.objs
+++ b/hw/misc/Makefile.objs
@@ -6,6 +6,7 @@ common-obj-$(CONFIG_ISA_DEBUG) += debugexit.o
 common-obj-$(CONFIG_SGA) += sga.o
 common-obj-$(CONFIG_ISA_TESTDEV) += pc-testdev.o
 common-obj-$(CONFIG_PCI_TESTDEV) += pci-testdev.o
+common-obj-$(CONFIG_EDU) += edu.o
 
 common-obj-y += unimp.o
 
@@ -53,7 +54,6 @@ obj-$(CONFIG_MIPS_CPS) += mips_cpc.o
 obj-$(CONFIG_MIPS_ITU) += mips_itu.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
-obj-$(CONFIG_EDU) += edu.o
 obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
 obj-$(CONFIG_AUX) += auxbus.o
 obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH v4 2/7] Move CONFIG_KVM related definitions to kvm_i386.h
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 2/7] Move CONFIG_KVM related definitions to kvm_i386.h Thomas Huth
@ 2017-06-26 11:12   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-06-26 11:12 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel, Paolo Bonzini

On 06/26/2017 02:22 AM, Thomas Huth wrote:
> pc.h and sysemu/kvm.h are also included from common code (where
> CONFIG_KVM is not available), so the #defines that depend on CONFIG_KVM
> should not be declared here to avoid that anybody is using them in a
> wrong way. Since we're also going to poison CONFIG_KVM for common code,
> let's move them to kvm_i386.h instead. Most of the dummy definitions
> from sysemu/kvm.h are also unused since the code that uses them is
> only compiled for CONFIG_KVM (e.g. target/i386/kvm.c), so the unused
> defines are also simply dropped here instead of being moved.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>   hw/i386/pc_q35.c       |  1 +
>   include/hw/i386/pc.h   | 13 -------------
>   include/sysemu/kvm.h   | 15 ---------------
>   target/i386/kvm_i386.h | 23 +++++++++++++++++++++++
>   4 files changed, 24 insertions(+), 28 deletions(-)
> 
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 1523ef3..8f696b7 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -36,6 +36,7 @@
>   #include "hw/timer/mc146818rtc.h"
>   #include "hw/xen/xen.h"
>   #include "sysemu/kvm.h"
> +#include "kvm_i386.h"
>   #include "hw/kvm/clock.h"
>   #include "hw/pci-host/q35.h"
>   #include "exec/address-spaces.h"
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 233216a..f48d167 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -20,19 +20,6 @@
>   
>   #define HPET_INTCAP "hpet-intcap"
>   
> -#ifdef CONFIG_KVM
> -#define kvm_pit_in_kernel() \
> -    (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
> -#define kvm_pic_in_kernel()  \
> -    (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
> -#define kvm_ioapic_in_kernel() \
> -    (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
> -#else
> -#define kvm_pit_in_kernel()      0
> -#define kvm_pic_in_kernel()      0
> -#define kvm_ioapic_in_kernel()   0
> -#endif
> -
>   /**
>    * PCMachineState:
>    * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index 1e91613..ca40b6e 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -22,21 +22,6 @@
>   #ifdef CONFIG_KVM
>   #include <linux/kvm.h>
>   #include <linux/kvm_para.h>
> -#else
> -/* These constants must never be used at runtime if kvm_enabled() is false.
> - * They exist so we don't need #ifdefs around KVM-specific code that already
> - * checks kvm_enabled() properly.
> - */
> -#define KVM_CPUID_SIGNATURE      0
> -#define KVM_CPUID_FEATURES       0
> -#define KVM_FEATURE_CLOCKSOURCE  0
> -#define KVM_FEATURE_NOP_IO_DELAY 0
> -#define KVM_FEATURE_MMU_OP       0
> -#define KVM_FEATURE_CLOCKSOURCE2 0
> -#define KVM_FEATURE_ASYNC_PF     0
> -#define KVM_FEATURE_STEAL_TIME   0
> -#define KVM_FEATURE_PV_EOI       0
> -#define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 0
>   #endif
>   
>   extern bool kvm_allowed;
> diff --git a/target/i386/kvm_i386.h b/target/i386/kvm_i386.h
> index bfce427..1de9876 100644
> --- a/target/i386/kvm_i386.h
> +++ b/target/i386/kvm_i386.h
> @@ -15,6 +15,29 @@
>   
>   #define kvm_apic_in_kernel() (kvm_irqchip_in_kernel())
>   
> +#ifdef CONFIG_KVM
> +
> +#define kvm_pit_in_kernel() \
> +    (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
> +#define kvm_pic_in_kernel()  \
> +    (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
> +#define kvm_ioapic_in_kernel() \
> +    (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
> +
> +#else
> +
> +#define kvm_pit_in_kernel()      0
> +#define kvm_pic_in_kernel()      0
> +#define kvm_ioapic_in_kernel()   0
> +
> +/* These constants must never be used at runtime if kvm_enabled() is false.
> + * They exist so we don't need #ifdefs around KVM-specific code that already
> + * checks kvm_enabled() properly.
> + */
> +#define KVM_CPUID_FEATURES       0
> +
> +#endif  /* CONFIG_KVM */
> +
>   bool kvm_allows_irq0_override(void);
>   bool kvm_has_smm(void);
>   bool kvm_has_adjust_clock_stable(void);
> 

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

* Re: [Qemu-devel] [PATCH v4 6/7] Makefile: Move bootdevice.o to common-obj-y
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 6/7] Makefile: Move bootdevice.o to common-obj-y Thomas Huth
@ 2017-06-26 11:12   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-06-26 11:12 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel, Paolo Bonzini

On 06/26/2017 02:22 AM, Thomas Huth wrote:
> There does not seem to be any target specific code in this file, so
> we can put it into "common-obj" instead of "obj" to compile it only
> once for all targets.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>   Makefile.objs   | 2 +-
>   Makefile.target | 2 +-
>   bootdevice.c    | 2 +-
>   3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile.objs b/Makefile.objs
> index b2e6322..756644c 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -40,7 +40,7 @@ io-obj-y = io/
>   
>   ifeq ($(CONFIG_SOFTMMU),y)
>   common-obj-y = blockdev.o blockdev-nbd.o block/
> -common-obj-y += iothread.o
> +common-obj-y += bootdevice.o iothread.o
>   common-obj-y += net/
>   common-obj-y += qdev-monitor.o device-hotplug.o
>   common-obj-$(CONFIG_WIN32) += os-win32.o
> diff --git a/Makefile.target b/Makefile.target
> index 0066579..ffa7a8f 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -137,7 +137,7 @@ endif #CONFIG_BSD_USER
>   # System emulator target
>   ifdef CONFIG_SOFTMMU
>   obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o numa.o
> -obj-y += qtest.o bootdevice.o
> +obj-y += qtest.o
>   obj-y += hw/
>   obj-y += memory.o
>   obj-y += memory_mapping.o
> diff --git a/bootdevice.c b/bootdevice.c
> index 33e3029..1141009 100644
> --- a/bootdevice.c
> +++ b/bootdevice.c
> @@ -27,7 +27,7 @@
>   #include "sysemu/sysemu.h"
>   #include "qapi/visitor.h"
>   #include "qemu/error-report.h"
> -#include "hw/hw.h"
> +#include "sysemu/reset.h"
>   #include "hw/qdev-core.h"
>   
>   typedef struct FWBootEntry FWBootEntry;
> 

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

* Re: [Qemu-devel] [PATCH v4 7/7] hw/misc/edu: Compile the edu device as common object
  2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 7/7] hw/misc/edu: Compile the edu device as common object Thomas Huth
@ 2017-06-26 11:13   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-06-26 11:13 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel, Paolo Bonzini

On 06/26/2017 02:22 AM, Thomas Huth wrote:
> edu.c does not contain any target-specific code, so we can put
> it into common-obj-y to compile it only once for all targets.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>   hw/misc/Makefile.objs | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
> index 2019846..7fc4e41 100644
> --- a/hw/misc/Makefile.objs
> +++ b/hw/misc/Makefile.objs
> @@ -6,6 +6,7 @@ common-obj-$(CONFIG_ISA_DEBUG) += debugexit.o
>   common-obj-$(CONFIG_SGA) += sga.o
>   common-obj-$(CONFIG_ISA_TESTDEV) += pc-testdev.o
>   common-obj-$(CONFIG_PCI_TESTDEV) += pci-testdev.o
> +common-obj-$(CONFIG_EDU) += edu.o
>   
>   common-obj-y += unimp.o
>   
> @@ -53,7 +54,6 @@ obj-$(CONFIG_MIPS_CPS) += mips_cpc.o
>   obj-$(CONFIG_MIPS_ITU) += mips_itu.o
>   
>   obj-$(CONFIG_PVPANIC) += pvpanic.o
> -obj-$(CONFIG_EDU) += edu.o
>   obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
>   obj-$(CONFIG_AUX) += auxbus.o
>   obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o
> 

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

end of thread, other threads:[~2017-06-26 11:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-26  5:22 [Qemu-devel] [PATCH v4 0/7] Poison some more target-specific defines Thomas Huth
2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 1/7] include/exec/poison: Add some more missing TARGET and CONFIG defines Thomas Huth
2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 2/7] Move CONFIG_KVM related definitions to kvm_i386.h Thomas Huth
2017-06-26 11:12   ` Philippe Mathieu-Daudé
2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 3/7] include/exec/poison: Mark CONFIG_KVM as poisoned, too Thomas Huth
2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 4/7] cpu: Introduce a wrapper for tlb_flush() that can be used in common code Thomas Huth
2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 5/7] include/exec/poison: Mark CONFIG_SOFTMMU as poisoned Thomas Huth
2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 6/7] Makefile: Move bootdevice.o to common-obj-y Thomas Huth
2017-06-26 11:12   ` Philippe Mathieu-Daudé
2017-06-26  5:22 ` [Qemu-devel] [PATCH v4 7/7] hw/misc/edu: Compile the edu device as common object Thomas Huth
2017-06-26 11:13   ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.