Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Janosch Frank <frankja@linux.ibm.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	borntraeger@linux.ibm.com, akrowiak@linux.ibm.com
Subject: Re: [RFC 07/10] KVM: s390: Use gpa_t and gva_t in gaccess files
Date: Wed, 18 Mar 2026 16:36:37 +0100	[thread overview]
Message-ID: <20260318163637.17ed4314@p-imbrenda> (raw)
In-Reply-To: <20260316180310.17765-8-frankja@linux.ibm.com>

On Mon, 16 Mar 2026 16:23:54 +0000
Janosch Frank <frankja@linux.ibm.com> wrote:

> A lot of addresses are being passed around as u64 or unsigned long
> instead of gpa_t and gva_t. Some of the variables are already called
> gva or gpa anyway.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
>  arch/s390/kvm/gaccess.c | 20 ++++++++++----------
>  arch/s390/kvm/gaccess.h |  3 +--
>  2 files changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/s390/kvm/gaccess.c b/arch/s390/kvm/gaccess.c
> index 7275854ee68e..b2e83f6e16ab 100644
> --- a/arch/s390/kvm/gaccess.c
> +++ b/arch/s390/kvm/gaccess.c
> @@ -441,7 +441,7 @@ static int get_vcpu_asce(struct kvm_vcpu *vcpu, union asce *asce,
>  	return 0;
>  }
>  
> -static int deref_table(struct kvm *kvm, unsigned long gpa, unsigned long *val)
> +static int deref_table(struct kvm *kvm, gpa_t gpa, unsigned long *val)
>  {
>  	return kvm_read_guest(kvm, gpa, val, sizeof(*val));
>  }
> @@ -467,8 +467,8 @@ static int deref_table(struct kvm *kvm, unsigned long gpa, unsigned long *val)
>   *	      the returned value is the program interruption code as defined
>   *	      by the architecture
>   */
> -static unsigned long guest_translate_gva(struct kvm_vcpu *vcpu, unsigned long gva,
> -					 unsigned long *gpa, const union asce asce,
> +static unsigned long guest_translate_gva(struct kvm_vcpu *vcpu, gva_t gva,
> +					 gpa_t *gpa, const union asce asce,
>  					 enum gacc_mode mode, enum prot_type *prot)
>  {
>  	union vaddress vaddr = {.addr = gva};
> @@ -477,8 +477,8 @@ static unsigned long guest_translate_gva(struct kvm_vcpu *vcpu, unsigned long gv
>  	int dat_protection = 0;
>  	int iep_protection = 0;
>  	union ctlreg0 ctlreg0;
> -	unsigned long ptr;
>  	int edat1, edat2, iep;
> +	gpa_t ptr;
>  
>  	ctlreg0.val = vcpu->arch.sie_block->gcr[0];
>  	edat1 = ctlreg0.edat && test_kvm_facility(vcpu->kvm, 8);
> @@ -772,7 +772,7 @@ static int vcpu_check_access_key_gpa(struct kvm_vcpu *vcpu, u8 access_key,
>   *		  be used to inject an exception into the guest.
>   */
>  static int guest_range_to_gpas(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
> -			       unsigned long *gpas, unsigned long len,
> +			       gpa_t *gpas, unsigned long len,
>  			       const union asce asce, enum gacc_mode mode,
>  			       u8 access_key)
>  {
> @@ -781,7 +781,7 @@ static int guest_range_to_gpas(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
>  	unsigned int fragment_len;
>  	int lap_enabled, rc = 0;
>  	enum prot_type prot;
> -	unsigned long gpa;
> +	gpa_t gpa;
>  
>  	lap_enabled = low_address_protection_enabled(vcpu, asce);
>  	while (min(PAGE_SIZE - offset, len) > 0) {
> @@ -932,11 +932,11 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
>  {
>  	psw_t *psw = &vcpu->arch.sie_block->gpsw;
>  	unsigned long nr_pages, idx;
> -	unsigned long gpa_array[2];
>  	unsigned int fragment_len;
> -	unsigned long *gpas;
>  	enum prot_type prot;
> +	gpa_t gpa_array[2];
>  	int need_ipte_lock;
> +	gpa_t *gpas;
>  	union asce asce;
>  	bool try_storage_prot_override;
>  	bool try_fetch_prot_override;
> @@ -1182,7 +1182,7 @@ int cmpxchg_guest_abs_with_key(struct kvm *kvm, gpa_t gpa, int len, union kvm_s3
>   * has to take care of this.
>   */
>  int guest_translate_address_with_key(struct kvm_vcpu *vcpu, unsigned long gva, u8 ar,
> -				     unsigned long *gpa, enum gacc_mode mode,
> +				     gpa_t *gpa, enum gacc_mode mode,
>  				     u8 access_key)
>  {
>  	union asce asce;
> @@ -1282,9 +1282,9 @@ static int walk_guest_tables(struct gmap *sg, unsigned long saddr, struct pgtwal
>  	struct guest_fault *entries;
>  	union dat_table_entry table;
>  	union vaddress vaddr;
> -	unsigned long ptr;
>  	struct kvm *kvm;
>  	union asce asce;
> +	gpa_t ptr;
>  	int rc;
>  
>  	if (!parent)
> diff --git a/arch/s390/kvm/gaccess.h b/arch/s390/kvm/gaccess.h
> index 086da7b040b5..f23dc0729649 100644
> --- a/arch/s390/kvm/gaccess.h
> +++ b/arch/s390/kvm/gaccess.h
> @@ -199,8 +199,7 @@ enum gacc_mode {
>  };
>  
>  int guest_translate_address_with_key(struct kvm_vcpu *vcpu, unsigned long gva, u8 ar,
> -				     unsigned long *gpa, enum gacc_mode mode,
> -				     u8 access_key);
> +				     gpa_t *gpa, enum gacc_mode mode, u8 access_key);
>  
>  int check_gva_range(struct kvm_vcpu *vcpu, unsigned long gva, u8 ar,
>  		    unsigned long length, enum gacc_mode mode, u8 access_key);


  reply	other threads:[~2026-03-18 15:36 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 16:23 [RFC 00/10] KVM: s390: spring cleanup Janosch Frank
2026-03-16 16:23 ` [RFC 01/10] KVM: s390: diag258: Pass absolute address to kvm_is_gpa_in_memslot() Janosch Frank
2026-03-16 18:34   ` Christian Borntraeger
2026-03-17 10:01   ` Christoph Schlameuss
2026-03-18 16:04   ` Claudio Imbrenda
2026-03-16 16:23 ` [RFC 02/10] KVM: s390: Consolidate lpswe variants Janosch Frank
2026-03-16 18:47   ` Christian Borntraeger
2026-03-17  8:13     ` Janosch Frank
2026-03-17 13:03     ` [PATCH] KVM: s390: Fix lpsw/e breaking event handling Janosch Frank
2026-03-17 13:30       ` Christian Borntraeger
2026-03-23 15:08       ` Hendrik Brueckner
2026-03-16 16:23 ` [RFC 03/10] KVM: s390: Convert shifts to gpa_to_gfn() Janosch Frank
2026-03-16 18:49   ` Christian Borntraeger
2026-03-17 10:38   ` Christoph Schlameuss
2026-03-18 14:26   ` Claudio Imbrenda
2026-03-16 16:23 ` [RFC 04/10] KVM: s390: kvm_s390_real_to_abs() should return gpa_t Janosch Frank
2026-03-16 18:53   ` Christian Borntraeger
2026-03-18  7:10   ` Christoph Schlameuss
2026-03-18 14:29   ` Claudio Imbrenda
2026-03-16 16:23 ` [RFC 05/10] KVM: s390: vsie: Cleanup and fixup of crycb handling Janosch Frank
2026-03-18 14:13   ` Christoph Schlameuss
2026-03-18 16:48   ` Claudio Imbrenda
2026-03-20 12:01   ` Anthony Krowiak
2026-03-23 15:54     ` Janosch Frank
2026-03-16 16:23 ` [RFC 06/10] KVM: s390: Rework lowcore access functions Janosch Frank
2026-03-18 14:25   ` Claudio Imbrenda
2026-03-23  9:11   ` Christoph Schlameuss
2026-03-16 16:23 ` [RFC 07/10] KVM: s390: Use gpa_t and gva_t in gaccess files Janosch Frank
2026-03-18 15:36   ` Claudio Imbrenda [this message]
2026-03-23  9:10   ` Christoph Schlameuss
2026-03-16 16:23 ` [RFC 08/10] KVM: s390: Use gpa_t in priv.c Janosch Frank
2026-03-18 16:02   ` Claudio Imbrenda
2026-03-30 14:53     ` Janosch Frank
2026-03-23  9:28   ` Christoph Schlameuss
2026-03-16 16:23 ` [RFC 09/10] KVM: s390: Use gpa_t in pv.c Janosch Frank
2026-03-18 15:46   ` Claudio Imbrenda
2026-03-23  9:41   ` Christoph Schlameuss
2026-03-30 14:36     ` Janosch Frank
2026-03-16 16:23 ` [RFC 10/10] KVM: s390: Cleanup kvm_s390_store_status_unloaded Janosch Frank
2026-03-18 15:51   ` Claudio Imbrenda
2026-03-23  9:47   ` Christoph Schlameuss

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=20260318163637.17ed4314@p-imbrenda \
    --to=imbrenda@linux.ibm.com \
    --cc=akrowiak@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    /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