[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 54/60] target/ppc: Reorder #ifdef'ry in kvm_ppc.h
From: |
Daniel Henrique Barboza |
Subject: |
[PULL 54/60] target/ppc: Reorder #ifdef'ry in kvm_ppc.h |
Date: |
Fri, 7 Jul 2023 08:31:02 -0300 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
Keep a single if/else/endif block checking CONFIG_KVM.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-ID: <20230627115124.19632-3-philmd@linaro.org>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
target/ppc/kvm_ppc.h | 62 ++++++++++++++++++++------------------------
1 file changed, 28 insertions(+), 34 deletions(-)
diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
index 2e395416f0..49954a300b 100644
--- a/target/ppc/kvm_ppc.h
+++ b/target/ppc/kvm_ppc.h
@@ -93,7 +93,34 @@ void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t
tb_offset);
int kvm_handle_nmi(PowerPCCPU *cpu, struct kvm_run *run);
-#else
+#define kvmppc_eieio() \
+ do { \
+ if (kvm_enabled()) { \
+ asm volatile("eieio" : : : "memory"); \
+ } \
+ } while (0)
+
+/* Store data cache blocks back to memory */
+static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len)
+{
+ uint8_t *p;
+
+ for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) {
+ asm volatile("dcbst 0,%0" : : "r"(p) : "memory");
+ }
+}
+
+/* Invalidate instruction cache blocks */
+static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len)
+{
+ uint8_t *p;
+
+ for (p = addr; p < addr + len; p += cpu->env.icache_line_size) {
+ asm volatile("icbi 0,%0" : : "r"(p));
+ }
+}
+
+#else /* !CONFIG_KVM */
static inline uint32_t kvmppc_get_tbfreq(void)
{
@@ -440,10 +467,6 @@ static inline bool
kvmppc_pvr_workaround_required(PowerPCCPU *cpu)
return false;
}
-#endif
-
-#ifndef CONFIG_KVM
-
#define kvmppc_eieio() do { } while (0)
static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len)
@@ -454,35 +477,6 @@ static inline void kvmppc_icbi_range(PowerPCCPU *cpu,
uint8_t *addr, int len)
{
}
-#else /* CONFIG_KVM */
-
-#define kvmppc_eieio() \
- do { \
- if (kvm_enabled()) { \
- asm volatile("eieio" : : : "memory"); \
- } \
- } while (0)
-
-/* Store data cache blocks back to memory */
-static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len)
-{
- uint8_t *p;
-
- for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) {
- asm volatile("dcbst 0,%0" : : "r"(p) : "memory");
- }
-}
-
-/* Invalidate instruction cache blocks */
-static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len)
-{
- uint8_t *p;
-
- for (p = addr; p < addr + len; p += cpu->env.icache_line_size) {
- asm volatile("icbi 0,%0" : : "r"(p));
- }
-}
-
#endif /* CONFIG_KVM */
#endif /* KVM_PPC_H */
--
2.41.0
- [PULL 42/60] ppc440: Remove ppc460ex_pcie_init legacy init function, (continued)
- [PULL 42/60] ppc440: Remove ppc460ex_pcie_init legacy init function, Daniel Henrique Barboza, 2023/07/07
- [PULL 45/60] ppc440_pcix: Stop using system io region for PCI bus, Daniel Henrique Barboza, 2023/07/07
- [PULL 46/60] ppc4xx_pci: Rename QOM type name define, Daniel Henrique Barboza, 2023/07/07
- [PULL 47/60] ppc4xx_pci: Add define for ppc4xx-host-bridge type name, Daniel Henrique Barboza, 2023/07/07
- [PULL 48/60] ppc440_pcix: Rename QOM type define abd move it to common header, Daniel Henrique Barboza, 2023/07/07
- [PULL 50/60] ppc/pnv: Set P10 core xscom region size to match hardware, Daniel Henrique Barboza, 2023/07/07
- [PULL 49/60] ppc/pnv: Log all unimp warnings with similar message, Daniel Henrique Barboza, 2023/07/07
- [PULL 51/60] tests/qtest: Add xscom tests for powernv10 machine, Daniel Henrique Barboza, 2023/07/07
- [PULL 52/60] target/ppc: Machine check on invalid real address access on POWER9/10, Daniel Henrique Barboza, 2023/07/07
- [PULL 53/60] target/ppc: Have 'kvm_ppc.h' include 'sysemu/kvm.h', Daniel Henrique Barboza, 2023/07/07
- [PULL 54/60] target/ppc: Reorder #ifdef'ry in kvm_ppc.h,
Daniel Henrique Barboza <=
- [PULL 55/60] target/ppc: Move CPU QOM definitions to cpu-qom.h, Daniel Henrique Barboza, 2023/07/07
- [PULL 56/60] target/ppc: Define TYPE_HOST_POWERPC_CPU in cpu-qom.h, Daniel Henrique Barboza, 2023/07/07
- [PULL 57/60] target/ppc: Restrict 'kvm_ppc.h' to sysemu in cpu_init.c, Daniel Henrique Barboza, 2023/07/07
- [PULL 58/60] target/ppc: Remove pointless checks of CONFIG_USER_ONLY in 'kvm_ppc.h', Daniel Henrique Barboza, 2023/07/07
- [PULL 59/60] ppc/pnv: Add QME region for P10, Daniel Henrique Barboza, 2023/07/07
- [PULL 60/60] ppc: Enable 2nd DAWR support on p10, Daniel Henrique Barboza, 2023/07/07
- Re: [PULL 00/60] ppc queue, Daniel Henrique Barboza, 2023/07/07