[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 22/33] target/ppc: extend eieio for POWER9
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 22/33] target/ppc: extend eieio for POWER9 |
Date: |
Tue, 12 Jun 2018 16:44:52 +1000 |
From: Cédric Le Goater <address@hidden>
POWER9 introduced a new variant of the eieio instruction using bit 6
as a hint to tell the CPU it is a store-forwarding barrier.
The usage of this eieio extension was recently added in Linux 4.17
which activated the "support for a store forwarding barrier at kernel
entry/exit".
Unfortunately, it is not possible to insert this new eieio instruction
without considerable change in ppc_tr_translate_insn(). So instead we
loosen the QEMU eieio instruction mask and modify the gen_eieio()
helper to test for bit6. On non-POWER9 CPUs, the bit6 is just ignored
but a warning is emitted as this is not an instruction software should
be using.
Signed-off-by: Cédric Le Goater <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/translate.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 8ba8f67dc5..5fe1ba6555 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -2967,7 +2967,28 @@ static void gen_stswx(DisasContext *ctx)
/* eieio */
static void gen_eieio(DisasContext *ctx)
{
- tcg_gen_mb(TCG_MO_LD_ST | TCG_BAR_SC);
+ TCGBar bar = TCG_MO_LD_ST;
+
+ /*
+ * POWER9 has a eieio instruction variant using bit 6 as a hint to
+ * tell the CPU it is a store-forwarding barrier.
+ */
+ if (ctx->opcode & 0x2000000) {
+ /*
+ * ISA says that "Reserved fields in instructions are ignored
+ * by the processor". So ignore the bit 6 on non-POWER9 CPU but
+ * as this is not an instruction software should be using,
+ * complain to the user.
+ */
+ if (!(ctx->insns_flags2 & PPC2_ISA300)) {
+ qemu_log_mask(LOG_GUEST_ERROR, "invalid eieio using bit 6 at @"
+ TARGET_FMT_lx "\n", ctx->base.pc_next - 4);
+ } else {
+ bar = TCG_MO_ST_LD;
+ }
+ }
+
+ tcg_gen_mb(bar | TCG_BAR_SC);
}
#if !defined(CONFIG_USER_ONLY)
@@ -6483,7 +6504,7 @@ GEN_HANDLER(lswi, 0x1F, 0x15, 0x12, 0x00000001,
PPC_STRING),
GEN_HANDLER(lswx, 0x1F, 0x15, 0x10, 0x00000001, PPC_STRING),
GEN_HANDLER(stswi, 0x1F, 0x15, 0x16, 0x00000001, PPC_STRING),
GEN_HANDLER(stswx, 0x1F, 0x15, 0x14, 0x00000001, PPC_STRING),
-GEN_HANDLER(eieio, 0x1F, 0x16, 0x1A, 0x03FFF801, PPC_MEM_EIEIO),
+GEN_HANDLER(eieio, 0x1F, 0x16, 0x1A, 0x01FFF801, PPC_MEM_EIEIO),
GEN_HANDLER(isync, 0x13, 0x16, 0x04, 0x03FFF801, PPC_MEM),
GEN_HANDLER_E(lbarx, 0x1F, 0x14, 0x01, 0, PPC_NONE, PPC2_ATOMIC_ISA206),
GEN_HANDLER_E(lharx, 0x1F, 0x14, 0x03, 0, PPC_NONE, PPC2_ATOMIC_ISA206),
--
2.17.1
- [Qemu-ppc] [PULL 06/33] 40p: remove pci_allow_0_address = true from 40p machine class, (continued)
- [Qemu-ppc] [PULL 06/33] 40p: remove pci_allow_0_address = true from 40p machine class, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 05/33] target/ppc: Use proper logging function for possible guest errors, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 08/33] target/ppc: Factor out the parsing in kvmppc_get_cpu_characteristics(), David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 16/33] ppc: remove obsolete macio_init() definition from mac.h, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 15/33] ppc: remove obsolete pci_pmac_init() definitions from mac.h, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 17/33] ppc: add missing FW_CFG_PPC_NVRAM_FLAT definition, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 14/33] hw/misc/mos6522: Add trailing '\n' to qemu_log() calls, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 20/33] mos6522: move timer frequency initialisation to mos6522_reset, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 12/33] MAINTAINERS: Add an entry for the MacIO device headers, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 19/33] cuda: embed mos6522_cuda device directly rather than using QOM object link, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 22/33] target/ppc: extend eieio for POWER9,
David Gibson <=
- [Qemu-ppc] [PULL 18/33] mos6522: fix vmstate_mos6522_timer version in vmstate_mos6522, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 29/33] spapr: handle pc-dimm unplug via hotplug handler chain, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 30/33] spapr: handle cpu core unplug via hotplug handler chain, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 31/33] ppc/pnv: fix LPC HC firmware address space, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 21/33] mos6522: convert VMSTATE_TIMER_PTR_TEST to VMSTATE_TIMER_PTR, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 26/33] spapr: move lookup of the node into spapr_memory_plug(), David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 33/33] spapr_pci: Remove unhelpful pagesize warning, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 24/33] target/ppc: Allow PIR read in privileged mode, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 25/33] spapr: no need to verify the node, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 23/33] ppc4xx_i2c: Clean up and improve error logging, David Gibson, 2018/06/12