From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF63CC10F0E for ; Tue, 9 Apr 2019 13:11:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C73F82084F for ; Tue, 9 Apr 2019 13:11:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726936AbfDINLb (ORCPT ); Tue, 9 Apr 2019 09:11:31 -0400 Received: from foss.arm.com ([217.140.101.70]:37884 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbfDINLb (ORCPT ); Tue, 9 Apr 2019 09:11:31 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 929B7A78; Tue, 9 Apr 2019 06:11:30 -0700 (PDT) Received: from [10.1.215.53] (e121566-lin.cambridge.arm.com [10.1.215.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B91A43F557; Tue, 9 Apr 2019 06:11:29 -0700 (PDT) Subject: Re: [PATCH kvm-unit-tests] arm: powerpc: comment halt(code) To: Andrew Jones , kvm@vger.kernel.org Cc: pbonzini@redhat.com, rkrcmar@redhat.com References: <20190409125104.28900-1-drjones@redhat.com> From: Alexandru Elisei Message-ID: <48be8649-e9c0-ad4d-c03d-e0b3de0d2c79@arm.com> Date: Tue, 9 Apr 2019 14:11:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190409125104.28900-1-drjones@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 4/9/19 1:51 PM, Andrew Jones wrote: > We're being a bit tricky when we change the prototype of halt() to > take 'code' as an argument. Doing this gives us a last chance to > see it when inspecting the halted unit test state (it'll be in > r0/x0 for arm/arm64 and r3 for powerpc.) Let's comment this trick > to avoid confusion. > > Suggested-by: Alexandru Elisei > Signed-off-by: Andrew Jones > --- > lib/arm/io.c | 10 ++++++++-- > lib/powerpc/io.c | 9 +++++++-- > 2 files changed, 15 insertions(+), 4 deletions(-) > > diff --git a/lib/arm/io.c b/lib/arm/io.c > index 8226b765bdc5..99fd31560084 100644 > --- a/lib/arm/io.c > +++ b/lib/arm/io.c > @@ -18,8 +18,6 @@ > > #include "io.h" > > -extern void halt(int code); > - > static struct spinlock uart_lock; > /* > * Use this guess for the uart base in order to make an attempt at > @@ -89,6 +87,14 @@ void puts(const char *s) > spin_unlock(&uart_lock); > } > > + > +/* > + * Defining halt to take 'code' as an argument guarantees that it will > + * be in x0/r0 when we halt. That gives us a final chance to see the exit > + * status while inspecting the halted unit test state. > + */ > +extern void halt(int code); > + > void exit(int code) > { > chr_testdev_exit(code); > diff --git a/lib/powerpc/io.c b/lib/powerpc/io.c > index 217eb0770ef5..a381688bce51 100644 > --- a/lib/powerpc/io.c > +++ b/lib/powerpc/io.c > @@ -11,8 +11,6 @@ > #include > #include "io.h" > > -extern void halt(int code); > - > static struct spinlock print_lock; > > void io_init(void) > @@ -28,6 +26,13 @@ void puts(const char *s) > spin_unlock(&print_lock); > } > > +/* > + * Defining halt to take 'code' as an argument guarantees that it will > + * be in r3 when we halt. That gives us a final chance to see the exit > + * status while inspecting the halted unit test state. > + */ > +extern void halt(int code); > + > void exit(int code) > { > // FIXME: change this print-exit/rtas-poweroff to chr_testdev_exit(), Reviewed-by: Alexandru Elisei