From patchwork Thu Mar 3 11:23:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 591394 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A302C14142D for ; Thu, 3 Mar 2016 22:23:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756502AbcCCLXP (ORCPT ); Thu, 3 Mar 2016 06:23:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45942 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754777AbcCCLXM (ORCPT ); Thu, 3 Mar 2016 06:23:12 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 9526E46217; Thu, 3 Mar 2016 11:23:11 +0000 (UTC) Received: from thh440s.fritz.box (vpn1-5-85.ams2.redhat.com [10.36.5.85]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u23BN8ND031609; Thu, 3 Mar 2016 06:23:09 -0500 From: Thomas Huth To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, drjones@redhat.com, pbonzini@redhat.com Cc: dgibson@redhat.com, lvivier@redhat.com Subject: [kvm-unit-tests PATCH] powerpc/spapr_hcall: Fix assembler constraints of the h_random h-call Date: Thu, 3 Mar 2016 12:23:08 +0100 Message-Id: <1457004188-17186-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org As noted by Laurent Vivier, a register that is marked with "+r" as input and output is not required to be listed in the set of input registers anymore. And as noted by David Gibson, the sPAPR hypercall is also allowed to clobber a bunch of other registers. According to the LoPAPR spec, r0 and r3-r12, CTR, XER and CC registers are volatile, so we should mark them in the clobber list. Signed-off-by: Thomas Huth --- powerpc/spapr_hcall.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/powerpc/spapr_hcall.c b/powerpc/spapr_hcall.c index 46731e1..dbff630 100644 --- a/powerpc/spapr_hcall.c +++ b/powerpc/spapr_hcall.c @@ -96,7 +96,9 @@ static int h_random(uint64_t *val) register uint64_t r3 asm("r3") = H_RANDOM; register uint64_t r4 asm("r4"); - asm volatile (" sc 1 " : "+r"(r3), "=r"(r4) : "r"(r3)); + asm volatile (" sc 1 " : "+r"(r3), "=r"(r4) : + : "r0", "r5", "r6", "r7", "r8", "r9", "r10", + "r11", "r12", "xer", "ctr", "cc"); *val = r4; return r3;