[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/3] xen/ppc: Set up a basic C environment


  • To: Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 23 Jun 2023 18:59:54 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9DCSMUYWLXeZ3uQb0/zEoP7pP7PNmqrUmyP/r7MfzCQ=; b=Tgx4+rE4qDBn+evRkaoDZ2NzYd6SBAsT3fm/oF51UbySHfnOY24YA2Ba8rAKKTJbM3DzHFirN1m/tit9yAA5oAQw61CUVAB2Cp2HO0qjUhHNVFbu7YvYJzBaqp1mp83Gz7E6NloMLuCAnPXDRwoBaKMTy+bm3UOiCZ7DUnhwDu2Zv6cf6aJMn9UmyszYV6McIrgwW0gAtMXNBPq6m/FmqIKdeTa5gniZB/H7GH7G9hE4dAlAKsNbYHjOjLCV6JwD5g+J3Q2bzvTHqBlE83V+arQU3sAUEk8abHzOCzcg+Re/3QAwFPT54+uFNUKHiSYbjG70DSAG6vRxf1sm1buFMw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aQk7yeCZiKloexHOAwHrEgZ56jpNrqOYlsLWrFWlaHGG0oZWl46ZFkvKlou9exylxPVoiXW6gzeKGaau4lHKzoct5RR6UCIcn9uBIdd9fXqO5svspGP5WqqqMR8PW1892BP1d+lk8+6pSNwsXgNLr5+tWztC5OmyM83/dDMmLcdLp0LSohLUgWw3kaPuEZRC/0sJVT9s1aujodtT/vJ4jkxZNUNyvJ/xkMdbKtJxPVVLxXK5JEvEO16aTPE+iSRc9gsxZxFGn6M9e7WxWX0rLrBqrLMbcqwEq6pAcQ2r9TAgH84+BJNikIsBEo8iAl9ZiS/lvJL0bbjpyD1hSFcvjw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Timothy Pearson <tpearson@xxxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 23 Jun 2023 17:00:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 23.06.2023 16:41, Shawn Anastasio wrote:
> On 6/23/23 1:34 AM, Jan Beulich wrote:
>> On 23.06.2023 03:26, Shawn Anastasio wrote:
>>> On 6/22/23 5:49 PM, Andrew Cooper wrote:
>>>> On 22/06/2023 9:57 pm, Shawn Anastasio wrote:
>>>>> --- /dev/null
>>>>> +++ b/xen/arch/ppc/setup.c
>>>>> @@ -0,0 +1,13 @@
>>>>> +/* SPDX-License-Identifier: GPL-2.0-or-later */
>>>>> +#include <xen/init.h>
>>>>> +
>>>>> +void __init noreturn start_xen(unsigned long r3, unsigned long r4,
>>>>> +                               unsigned long r5, unsigned long r6,
>>>>> +                               unsigned long r7)
>>>>> +{
>>>>> +    for ( ;; )
>>>>> +        /* Set current hardware thread to very low priority */
>>>>> +        asm volatile("or %r31, %r31, %r31");
>>>>
>>>> Is there something magic about the OR instruction, or something magic
>>>> about %r31?
>>>
>>> Using the OR instruction with all three operands equal is of course a
>>> no-op, but when using certain registers it can have a separate magic
>>> side effect.
>>>
>>> `or r31,31,31` is one such form that sets the Program Priority Register
>>> to "very low" priority. Of course here where we don't have SMP going
>>> there's not much point in using this over the standard side effect-less
>>> no-op (`or r0,r0,r0` or just `nop`).
>>>
>>> For a table of these magic OR forms, you can see page 836 of the Power
>>> ISA 3.0B:
>>> https://wiki.raptorcs.com/w/images/c/cb/PowerISA_public.v3.0B.pdf
>>
>> I have 3.1 to hand, and it looks like they were dropped from there?
>> Otherwise I was meaning to say that it's a shame gas doesn't support
>> these.
> 
> No, they're still present in ISA 3.1B. See page 1084, Book II Chapter
> 3 Section 2.

Ah, I see. I was searching for the pseudo mnemonics that I had
found elsewhere at some point (which are what I would hope gas
could support, but then of course they first need to be
mentioned in the doc).

>> Finally, as a nit: Style above is lacking several blanks. One
>> between the two semicolons, and a total of three in the asm().
> 
> Just to be sure, would the following be correct?
> 
>     for ( ; ; )
>         /* Set current hardware thread to very low priority */
>         asm volatile ( "or %r31, %r31, %r31" );
> 
> Not including the refactor of that instruction to a macro, of course.

Yes, this looks correct now. Our style is perhaps a little
unusual; at least I'm not aware of another project using the
same, although I have the vague feeling that someone once
mentioned a possible origin.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.