public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	nrb@linux.ibm.com, hca@linux.ibm.com
Subject: Re: [kvm-unit-tests PATCH] lib: s390x: css: Name inline assembly arguments and clean them up
Date: Thu, 6 Feb 2025 11:36:11 +0100	[thread overview]
Message-ID: <97262c67-b04e-4015-a081-f1024e8a31a2@linux.ibm.com> (raw)
In-Reply-To: <20250205112550.45a6b2cd@p-imbrenda>

On 2/5/25 11:25 AM, Claudio Imbrenda wrote:
> On Tue,  4 Feb 2025 09:51:33 +0000
> Janosch Frank <frankja@linux.ibm.com> wrote:
> 
>> Less need to count the operands makes the code easier to read.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>
>> This one has been gathering dust for a while.
>> rfc->v1: Moved to Q constraint (thanks Heiko)
>>
>> ---
> 
> [...]
> 
>>   	asm volatile(" .insn   rre,0xb25f0000,%2,0\n"
>> -		     " ipm     %0\n"
>> -		     " srl     %0,28\n"
>> -		     : "=d" (cc), "=m" (p)
>> +		     " ipm     %[cc]\n"
>> +		     " srl     %[cc],28\n"
>> +		     : [cc] "=d" (cc), "=m" (p)
>>   		     : "d" (p), "m" (p)
> 
> this bit (which you did not touch) is actually the most confusing to me.
> what's the point of separately specifying both "d" and "m" constraints
> for (p) ? (and it also has a "=m" in the output clobberlist)

I consulted the kernel code as well as Heiko and the architecture.

CHSC is one of those request/response do everything instructions and is 
similar to sclp. A header is read from memory and a response is written 
below the header. The addressed memory needs to be page aligned and can 
be up to a page in size.

Which means:
  - We need the address in R1
  - CPU reads from the memory area designated by R1
  - CPU writes to the memory area designated by R1

My guess is that nobody bothered defining all of the structs and that's 
how we ended up here. If you look at the kernel assembly you'll notice a 
page size typedef for the +m clobber of the memory area pointer.

Heiko suggested to drop the two "m" clobbers and just add a generic 
memory clobber. If we even want to touch this at all...

  parent reply	other threads:[~2025-02-06 10:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-04  9:51 [kvm-unit-tests PATCH] lib: s390x: css: Name inline assembly arguments and clean them up Janosch Frank
2025-02-04 12:55 ` Nico Boehr
2025-02-05  8:17   ` Janosch Frank
2025-02-05 10:25 ` Claudio Imbrenda
2025-02-05 12:08   ` Janosch Frank
2025-02-06 10:36   ` Janosch Frank [this message]
2025-02-06 12:03     ` Claudio Imbrenda
2025-02-06 12:42     ` Nico Boehr
2025-02-06 17:22 ` Claudio Imbrenda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97262c67-b04e-4015-a081-f1024e8a31a2@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox