From patchwork Sun Mar 12 17:03:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 737840 X-Patchwork-Delegate: paulus@samba.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vh6sG5PqZz9s7K for ; Mon, 13 Mar 2017 04:08:34 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="C9vbTWWZ"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vh6sG2n2LzDqYd for ; Mon, 13 Mar 2017 04:08:34 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="C9vbTWWZ"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3vh6mJ0Z2VzDqYB for ; Mon, 13 Mar 2017 04:04:16 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="C9vbTWWZ"; dkim-atps=neutral Received: by mail-pg0-x243.google.com with SMTP id g2so11195925pge.2 for ; Sun, 12 Mar 2017 10:04:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BfCU6AMmKFkSNkXovv6vZ579YwuiV5uu++s1MPtNJIg=; b=C9vbTWWZev9NDU9DPGbL0nbNgtG7GYvE8W55fQwhQOoLMk32mriejLCL1PYH0KoZVa 20bcu3WBN0MhjNHPOZIdB892S2pZi+B737nhPN3rlPr9ooq1zYwinJrVUXHH/NvsQir9 dw3tevOZCcnCT8ANtBuBBvzEGkzac1JqLCb1q2IJmAlh67a7BOfy7zmjbVsd2H4/V5D8 fB3pDnqA0tbBR3YoC9QAJ8LlF6KRqI+sXj6lCa5XfTVg/6T8pHxB+SWkBHUFN7CeiWz1 2J+4EepalZXMGG5EScbcJV5BYjNYj0p8peV4fVC9Jw6wq9IJCzPVfAgfr4iViOorhoFp krbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BfCU6AMmKFkSNkXovv6vZ579YwuiV5uu++s1MPtNJIg=; b=W7MPWWv7+Tl8g2VyIgqfs34Hobub+4jWuY7VyqSPCSQGYKqYe84ADeOdQcwmflHlwd Y1OeNeqz0v5X3TAlV5YTi5QHwW/QaG8OLXB7fMmepcplQcuiau79U2WdMRSxW3JD26kt 4ZiSrdOKUZImFV0t3ay0QFGyvPYsxX1uvUeFVwjH+ZvNrtGmG3lQ35zezaqct8I3EL+4 g0CQkex+nGKcV1/NQ2kNoYrFILTLn6D0QbybMqqBIQYGtmZGgg2nBn1qy+fGts9vzfo7 pYLbPpiix7JpaqFdnI6kkCFJ1Wm0TAHNyEDzxN7VQCatzg3v5ROvm5uUtk8K97W9HM2K tS4A== X-Gm-Message-State: AMke39nLLieUmXzOaXDuQgODx6GjkA+8zF2b0CIhBzHP3Lmhvjb/xbK0XI5iwhdD1JASzg== X-Received: by 10.84.129.195 with SMTP id b61mr41230924plb.83.1489338254460; Sun, 12 Mar 2017 10:04:14 -0700 (PDT) Received: from roar.au.ibm.com ([203.221.48.234]) by smtp.gmail.com with ESMTPSA id 73sm29194691pfh.56.2017.03.12.10.04.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Mar 2017 10:04:13 -0700 (PDT) From: Nicholas Piggin To: kvm-ppc@vger.kernel.org Subject: [PATCH] KVM: PPC: Book3S HV: Use msgsync for hypervisor doorbells on POWER9 Date: Mon, 13 Mar 2017 03:03:49 +1000 Message-Id: <20170312170349.20323-2-npiggin@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170312170349.20323-1-npiggin@gmail.com> References: <20170312170349.20323-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Mackerras , linuxppc-dev@lists.ozlabs.org, Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" When msgsnd is used for IPIs to other cores, msgsync must be executed by the target to order stores performed on the source before its msgsnd (provided the source executes the appropriate sync). Fixes: 1704a81ccebc ("KVM: PPC: Book3S HV: Use msgsnd for IPIs to other cores on POWER9") Signed-off-by: Nicholas Piggin --- Hi, I found this by inspection only and don't have a way to test it (I have no POWER9 KVM set up yet). I don't know the KVM interrupt code very well, so it might not be the right way to fix it. Flames welcome. Thanks, Nick arch/powerpc/include/asm/ppc-opcode.h | 2 ++ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 3 +++ 2 files changed, 5 insertions(+) diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h index e7d6d86563ee..142d78d645f4 100644 --- a/arch/powerpc/include/asm/ppc-opcode.h +++ b/arch/powerpc/include/asm/ppc-opcode.h @@ -161,6 +161,7 @@ #define PPC_INST_MFTMR 0x7c0002dc #define PPC_INST_MSGSND 0x7c00019c #define PPC_INST_MSGCLR 0x7c0001dc +#define PPC_INST_MSGSYNC 0x7c0006ec #define PPC_INST_MSGSNDP 0x7c00011c #define PPC_INST_MTTMR 0x7c0003dc #define PPC_INST_NOP 0x60000000 @@ -345,6 +346,7 @@ ___PPC_RB(b) | __PPC_EH(eh)) #define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \ ___PPC_RB(b)) +#define PPC_MSGSYNC stringify_in_c(.long PPC_INST_MSGSYNC) #define PPC_MSGCLR(b) stringify_in_c(.long PPC_INST_MSGCLR | \ ___PPC_RB(b)) #define PPC_MSGSNDP(b) stringify_in_c(.long PPC_INST_MSGSNDP | \ diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 7c6477d1840a..caba3afe787d 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S @@ -1239,6 +1239,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) /* Hypervisor doorbell - exit only if host IPI flag set */ cmpwi r12, BOOK3S_INTERRUPT_H_DOORBELL bne 3f +BEGIN_FTR_SECTION + PPC_MSGSYNC +END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) lbz r0, HSTATE_HOST_IPI(r13) cmpwi r0, 0 beq 4f