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: 8491371 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 501AB9F38C for ; Thu, 3 Mar 2016 11:23:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8727B200BE for ; Thu, 3 Mar 2016 11:23:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A611E20373 for ; Thu, 3 Mar 2016 11:23:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757408AbcCCLXP (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-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;