[Top][All Lists]

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

Re: [PATCH v2 04/13] s390x/tcg: check for addressing exceptions for RRBE

From: David Hildenbrand
Subject: Re: [PATCH v2 04/13] s390x/tcg: check for addressing exceptions for RRBE, SSKE and ISKE
Date: Mon, 16 Aug 2021 17:12:48 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 16.08.21 17:10, Cornelia Huck wrote:
On Wed, Aug 11 2021, David Hildenbrand <david@redhat.com> wrote:

Let's replace the ram_size check by a proper physical address space
check (for example, to prepare for memory hotplug), trigger addressing
exceptions and trace the return value of the storage key getter/setter.

Provide an helper mmu_absolute_addr_valid() to be used in other context
soon. Always test for "read" instead of "write" as we are not actually
modifying the page itself.

Signed-off-by: David Hildenbrand <david@redhat.com>
  target/s390x/helper.h         |  6 +++---
  target/s390x/mmu_helper.c     |  8 ++++++++
  target/s390x/s390x-internal.h |  1 +
  target/s390x/tcg/mem_helper.c | 36 ++++++++++++++++++++++-------------
  4 files changed, 35 insertions(+), 16 deletions(-)

diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c
index dd506d8d17..90ac82fdcc 100644
--- a/target/s390x/tcg/mem_helper.c
+++ b/target/s390x/tcg/mem_helper.c
@@ -28,6 +28,7 @@
  #include "qemu/int128.h"
  #include "qemu/atomic128.h"
  #include "tcg/tcg.h"
+#include "trace.h"
#if !defined(CONFIG_USER_ONLY)
  #include "hw/s390x/storage-keys.h"
@@ -2171,15 +2172,15 @@ uint32_t HELPER(tprot)(CPUS390XState *env, uint64_t a1, 
uint64_t a2)
  /* insert storage key extended */
  uint64_t HELPER(iske)(CPUS390XState *env, uint64_t r2)
-    MachineState *ms = MACHINE(qdev_get_machine());
      static S390SKeysState *ss;
      static S390SKeysClass *skeyclass;
      uint64_t addr = wrap_address(env, r2);
      uint8_t key;
+    int rc;
addr = mmu_real2abs(env, addr);
-    if (addr > ms->ram_size) {
-        return 0;
+    if (!mmu_absolute_addr_valid(addr, false)) {
+        trigger_pgm_exception(env, PGM_ADDRESSING);

Don't you need s390_program_interrupt() instead?

Very good catch! Indeed, we want s390_program_interrupt() or even tcg_s390_program_interrupt().


David / dhildenb

reply via email to

[Prev in Thread] Current Thread [Next in Thread]