qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>,
	Thomas Huth <thuth@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	Halil Pasic <pasic@linux.ibm.com>,
	Eric Farman <farman@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	qemu-s390x@nongnu.org, Ilya Leoshkevich <iii@linux.ibm.com>
Subject: Re: [PATCH 2/4] hw/s390x/sclp: Have sclp_service_call[_protected]() take S390CPU*
Date: Tue, 7 Nov 2023 13:10:07 +0100	[thread overview]
Message-ID: <49a53d43-cc99-48f8-9e3f-41e8abd32b37@linaro.org> (raw)
In-Reply-To: <20231106114500.5269-3-philmd@linaro.org>

On 6/11/23 12:44, Philippe Mathieu-Daudé wrote:
> "hw/s390x/sclp.h" is a header used by target-agnostic objects
> (such hw/char/sclpconsole[-lm].c), thus can not use target-specific
> types, such CPUS390XState.
> 
> Have sclp_service_call[_protected]() take a S390CPU pointer, which
> is target-agnostic.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/s390x/sclp.h        | 5 ++---
>   hw/s390x/sclp.c                | 7 ++++---
>   target/s390x/kvm/kvm.c         | 2 +-
>   target/s390x/tcg/misc_helper.c | 2 +-
>   4 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h
> index 9aef6d9370..e229b81a67 100644
> --- a/include/hw/s390x/sclp.h
> +++ b/include/hw/s390x/sclp.h
> @@ -227,8 +227,7 @@ static inline int sccb_data_len(SCCB *sccb)
>   void s390_sclp_init(void);
>   void sclp_service_interrupt(uint32_t sccb);
>   void raise_irq_cpu_hotplug(void);
> -int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code);
> -int sclp_service_call_protected(CPUS390XState *env, uint64_t sccb,
> -                                uint32_t code);
> +int sclp_service_call(S390CPU *cpu, uint64_t sccb, uint32_t code);
> +int sclp_service_call_protected(S390CPU *cpu, uint64_t sccb, uint32_t code);
>   
>   #endif
> diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
> index d339cbb7e4..893e71a41b 100644
> --- a/hw/s390x/sclp.c
> +++ b/hw/s390x/sclp.c
> @@ -269,9 +269,9 @@ static void sclp_execute(SCLPDevice *sclp, SCCB *sccb, uint32_t code)
>    * service_interrupt call.
>    */
>   #define SCLP_PV_DUMMY_ADDR 0x4000
> -int sclp_service_call_protected(CPUS390XState *env, uint64_t sccb,
> -                                uint32_t code)
> +int sclp_service_call_protected(S390CPU *cpu, uint64_t sccb, uint32_t code)
>   {
> +    CPUS390XState *env = &cpu->env;
>       SCLPDevice *sclp = get_sclp_device();
>       SCLPDeviceClass *sclp_c = SCLP_GET_CLASS(sclp);
>       SCCBHeader header;
> @@ -296,8 +296,9 @@ out_write:
>       return 0;
>   }
>   
> -int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code)
> +int sclp_service_call(S390CPU *cpu, uint64_t sccb, uint32_t code)
>   {
> +    CPUS390XState *env = &cpu->env;
>       SCLPDevice *sclp = get_sclp_device();
>       SCLPDeviceClass *sclp_c = SCLP_GET_CLASS(sclp);
>       SCCBHeader header;
> diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
> index 1ddad0bec1..a12fbfc026 100644
> --- a/target/s390x/kvm/kvm.c
> +++ b/target/s390x/kvm/kvm.c
> @@ -1174,7 +1174,7 @@ static void kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run,
>           break;
>       case ICPT_PV_INSTR:
>           g_assert(s390_is_pv());
> -        sclp_service_call_protected(env, sccb, code);
> +        sclp_service_call_protected(cpu, sccb, code);
>           /* Setting the CC is done by the Ultravisor. */
>           break;
>       case ICPT_INSTRUCTION:

Here I forgot:
-- >8 --
@@ -1179,7 +1179,7 @@ static void kvm_sclp_service_call(S390CPU *cpu, 
struct kvm_run *run,
          break;
      case ICPT_INSTRUCTION:
          g_assert(!s390_is_pv());
-        r = sclp_service_call(env, sccb, code);
+        r = sclp_service_call(cpu, sccb, code);
          if (r < 0) {
              kvm_s390_program_interrupt(cpu, -r);
              return;
---

> diff --git a/target/s390x/tcg/misc_helper.c b/target/s390x/tcg/misc_helper.c
> index 56c7f00cf9..6aa7907438 100644
> --- a/target/s390x/tcg/misc_helper.c
> +++ b/target/s390x/tcg/misc_helper.c
> @@ -102,7 +102,7 @@ uint64_t HELPER(stck)(CPUS390XState *env)
>   uint32_t HELPER(servc)(CPUS390XState *env, uint64_t r1, uint64_t r2)
>   {
>       qemu_mutex_lock_iothread();
> -    int r = sclp_service_call(env, r1, r2);
> +    int r = sclp_service_call(env_archcpu(env), r1, r2);
>       qemu_mutex_unlock_iothread();
>       if (r < 0) {
>           tcg_s390_program_interrupt(env, -r, GETPC());



  reply	other threads:[~2023-11-07 12:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 11:44 [PATCH 0/4] target/s390x/cpu: Restrict CPUS390XState declaration to 'cpu.h' Philippe Mathieu-Daudé
2023-11-06 11:44 ` [PATCH 1/4] hw/s390x/css: Have css_do_sic() take S390CPU instead of CPUS390XState Philippe Mathieu-Daudé
2023-11-06 11:44 ` [PATCH 2/4] hw/s390x/sclp: Have sclp_service_call[_protected]() take S390CPU* Philippe Mathieu-Daudé
2023-11-07 12:10   ` Philippe Mathieu-Daudé [this message]
2023-11-06 11:44 ` [PATCH 3/4] target/s390x/cpu: Restrict cpu_get_tb_cpu_state() definition to TCG Philippe Mathieu-Daudé
2023-11-06 11:44 ` [PATCH 4/4] target/s390x/cpu: Restrict CPUS390XState declaration to 'cpu.h' Philippe Mathieu-Daudé
2023-11-07 15:29   ` Zhao Liu
2023-11-07 10:44 ` [PATCH 0/4] " Thomas Huth
2023-11-07 12:12   ` Philippe Mathieu-Daudé
2023-11-07 13:30     ` Thomas Huth
2023-11-07 11:21 ` Thomas Huth

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=49a53d43-cc99-48f8-9e3f-41e8abd32b37@linaro.org \
    --to=philmd@linaro.org \
    --cc=borntraeger@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.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;
as well as URLs for NNTP newsgroup(s).