[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: |
Cornelia Huck |
Subject: |
Re: [PATCH v2 04/13] s390x/tcg: check for addressing exceptions for RRBE, SSKE and ISKE |
Date: |
Mon, 16 Aug 2021 17:10:37 +0200 |
User-agent: |
Notmuch/0.32.1 (https://notmuchmail.org) |
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?
> }
>
> if (unlikely(!ss)) {
- [PATCH v2 00/13] s390x: skey related fixes, cleanups, and memory device preparations, David Hildenbrand, 2021/08/11
- [PATCH v2 01/13] s390x/tcg: wrap address for RRBE, David Hildenbrand, 2021/08/11
- [PATCH v2 02/13] s390x/tcg: fix ignoring bit 63 when setting the storage key in SSKE, David Hildenbrand, 2021/08/11
- [PATCH v2 03/13] s390x/tcg: convert real to absolute address for RRBE, SSKE and ISKE, David Hildenbrand, 2021/08/11
- [PATCH v2 04/13] s390x/tcg: check for addressing exceptions for RRBE, SSKE and ISKE, David Hildenbrand, 2021/08/11
- Re: [PATCH v2 04/13] s390x/tcg: check for addressing exceptions for RRBE, SSKE and ISKE,
Cornelia Huck <=
- [PATCH v2 05/13] s390x/mmu_helper: no need to pass access type to mmu_translate_asce(), David Hildenbrand, 2021/08/11
- [PATCH v2 06/13] s390x/mmu_helper: fixup mmu_translate() documentation, David Hildenbrand, 2021/08/11
- [PATCH v2 07/13] s390x/mmu_helper: move address validation into mmu_translate*(), David Hildenbrand, 2021/08/11
- [PATCH v2 08/13] s390x/mmu_helper: avoid setting the storage key if nothing changed, David Hildenbrand, 2021/08/11
- [PATCH v2 09/13] hw/s390x/s390-skeys: use memory mapping to detect which storage keys to migrate, David Hildenbrand, 2021/08/11
- [PATCH v2 10/13] hw/s390x/s390-skeys: use memory mapping to detect which storage keys to dump, David Hildenbrand, 2021/08/11
- [PATCH v2 11/13] hw/s390x/s390-skeys: check if an address is valid before dumping the key, David Hildenbrand, 2021/08/11
- [PATCH v2 12/13] hw/s390x/s390-skeys: rename skeys_enabled to skeys_are_enabled, David Hildenbrand, 2021/08/11
- [PATCH v2 13/13] hw/s390x/s390-skeys: lazy storage key enablement under TCG, David Hildenbrand, 2021/08/11