All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Holden <andy0x48@linux.ibm.com>
To: qemu-devel@nongnu.org, iii@linux.ibm.com, freude@linux.ibm.com
Cc: qemu-s390x@nongnu.org, richard.henderson@linaro.org,
	david@kernel.org, cohuck@redhat.com, farman@linux.ibm.com,
	mjrosato@linux.ibm.com, Andrew Holden <andy0x48@linux.ibm.com>
Subject: [PATCH v2 1/3] target/s390x: export access_prepare() and byte accessors
Date: Fri, 20 Nov 2026 13:14:41 +0000	[thread overview]
Message-ID: <20261120131443.61606-2-andy0x48@linux.ibm.com> (raw)
In-Reply-To: <20261120131443.61606-1-andy0x48@linux.ibm.com>

The helpers are needed by CPACF AES for a partial completion fix. There
is no functional change with this modification.

Signed-off-by: Andrew Holden <andy0x48@linux.ibm.com>
---
 target/s390x/s390x-internal.h | 25 +++++++++++++++++++++++++
 target/s390x/tcg/mem_helper.c | 33 ++++++++-------------------------
 2 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/target/s390x/s390x-internal.h b/target/s390x/s390x-internal.h
index da60b2b1fd..c97d399c99 100644
--- a/target/s390x/s390x-internal.h
+++ b/target/s390x/s390x-internal.h
@@ -368,6 +368,31 @@ void ioinst_handle_sal(S390CPU *cpu, uint64_t reg1, uintptr_t ra);
 
 
 /* mem_helper.c */
+
+/* An access covers at most 4096 bytes and therefore at most two pages. */
+typedef struct S390Access {
+    vaddr vaddr1;
+    vaddr vaddr2;
+    void *haddr1;
+    void *haddr2;
+    uint16_t size1;
+    uint16_t size2;
+    /*
+     * If we can't access the host page directly, we'll have to do I/O access
+     * via ld/st helpers. These are internal details, so we store the
+     * mmu idx to do the access here instead of passing it around in the
+     * helpers.
+     */
+    int mmu_idx;
+} S390Access;
+
+void access_prepare(S390Access *ret, CPUS390XState *env, vaddr vaddr,
+                    int size, MMUAccessType access_type, int mmu_idx,
+                    uintptr_t ra);
+uint8_t access_get_byte(CPUS390XState *env, S390Access *access, int offset,
+                        uintptr_t ra);
+void access_set_byte(CPUS390XState *env, S390Access *access, int offset,
+                     uint8_t byte, uintptr_t ra);
 void probe_write_access(CPUS390XState *env, uint64_t addr, uint64_t len,
                         uintptr_t ra);
 
diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c
index 414e6838c8..5144f036ad 100644
--- a/target/s390x/tcg/mem_helper.c
+++ b/target/s390x/tcg/mem_helper.c
@@ -126,23 +126,6 @@ static inline void cpu_stsize_data_ra(CPUS390XState *env, uint64_t addr,
     }
 }
 
-/* An access covers at most 4096 bytes and therefore at most two pages. */
-typedef struct S390Access {
-    vaddr vaddr1;
-    vaddr vaddr2;
-    void *haddr1;
-    void *haddr2;
-    uint16_t size1;
-    uint16_t size2;
-    /*
-     * If we can't access the host page directly, we'll have to do I/O access
-     * via ld/st helpers. These are internal details, so we store the
-     * mmu idx to do the access here instead of passing it around in the
-     * helpers.
-     */
-    int mmu_idx;
-} S390Access;
-
 /*
  * With nonfault=1, return the PGM_ exception that would have been injected
  * into the guest; return 0 if no exception was detected.
@@ -219,10 +202,10 @@ static int access_prepare_nf(S390Access *access, CPUS390XState *env,
     return 0;
 }
 
-static inline void access_prepare(S390Access *ret, CPUS390XState *env,
-                                  vaddr vaddr, int size,
-                                  MMUAccessType access_type, int mmu_idx,
-                                  uintptr_t ra)
+void access_prepare(S390Access *ret, CPUS390XState *env,
+                    vaddr vaddr, int size,
+                    MMUAccessType access_type, int mmu_idx,
+                    uintptr_t ra)
 {
     int exc = access_prepare_nf(ret, env, false, vaddr, size,
                                 access_type, mmu_idx, ra);
@@ -257,8 +240,8 @@ static void access_memset(CPUS390XState *env, S390Access *desta,
     clear_helper_retaddr();
 }
 
-static uint8_t access_get_byte(CPUS390XState *env, S390Access *access,
-                               int offset, uintptr_t ra)
+uint8_t access_get_byte(CPUS390XState *env, S390Access *access,
+                        int offset, uintptr_t ra)
 {
     vaddr vaddr = access->vaddr1;
     void *haddr = access->haddr1;
@@ -277,8 +260,8 @@ static uint8_t access_get_byte(CPUS390XState *env, S390Access *access,
     }
 }
 
-static void access_set_byte(CPUS390XState *env, S390Access *access,
-                            int offset, uint8_t byte, uintptr_t ra)
+void access_set_byte(CPUS390XState *env, S390Access *access,
+                     int offset, uint8_t byte, uintptr_t ra)
 {
     vaddr vaddr = access->vaddr1;
     void *haddr = access->haddr1;
-- 
2.56.0



  reply	other threads:[~2026-11-20 13:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 13:14 [PATCH v2 0/3] Fix AES/PAES CPACF register update on faults Andrew Holden
2026-11-20 13:14 ` Andrew Holden [this message]
2026-11-20 13:14 ` [PATCH v2 2/3] target/s390x/tcg: update regs and IV/tweak per block in CPACF AES/PAES Andrew Holden
2026-11-20 13:14 ` [PATCH v2 3/3] tests/s390x/tcg: Add cpacf clear key register update tests Andrew Holden

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=20261120131443.61606-2-andy0x48@linux.ibm.com \
    --to=andy0x48@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@kernel.org \
    --cc=farman@linux.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.