qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] c9d793: target/sparc: Factor out the body of


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] c9d793: target/sparc: Factor out the body of sparc_cpu_una...
Date: Tue, 17 Sep 2019 06:55:34 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: c9d793f44620a4793239da73f67758ce5f5ba5d0
      
https://github.com/qemu/qemu/commit/c9d793f44620a4793239da73f67758ce5f5ba5d0
  Author: Peter Maydell <address@hidden>
  Date:   2019-09-17 (Tue, 17 Sep 2019)

  Changed paths:
    M target/sparc/ldst_helper.c

  Log Message:
  -----------
  target/sparc: Factor out the body of sparc_cpu_unassigned_access()

Currently the SPARC target uses the old-style do_unassigned_access
hook.  We want to switch it over to do_transaction_failed, but to do
this we must first remove all the direct calls in ldst_helper.c to
cpu_unassigned_access().  Factor out the body of the hook function's
code into a new sparc_raise_mmu_fault() and call it from the hook and
from the various places that used to call cpu_unassigned_access().

In passing, this fixes a bug where the code that raised the
MMU exception was directly calling GETPC() from a function that
was several levels deep in the callstack from the original
helper function: the new sparc_raise_mmu_fault() instead takes
the return address as an argument.

Other than the use of retaddr rather than GETPC() and a comment
format fixup, the body of the new function has no changes from
that of the old hook function.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Tested-by: Mark Cave-Ayland <address@hidden>
Message-id: address@hidden


  Commit: b9f5fdad49c74583dcf9fcba0805b148e3992e13
      
https://github.com/qemu/qemu/commit/b9f5fdad49c74583dcf9fcba0805b148e3992e13
  Author: Peter Maydell <address@hidden>
  Date:   2019-09-17 (Tue, 17 Sep 2019)

  Changed paths:
    M target/sparc/ldst_helper.c

  Log Message:
  -----------
  target/sparc: Check for transaction failures in MMU passthrough ASIs

Currently the ld/st_asi helper functions make calls to the
ld*_phys() and st*_phys() functions for those ASIs which
imply direct accesses to physical addresses. These implicitly
rely on the unassigned_access hook to cause them to generate
an MMU fault if the access fails.

Switch to using the address_space_* functions instead, which
return a MemTxResult that we can check. This means that when
we switch SPARC over to using the do_transaction_failed hook
we'll still get the same MMU faults we did before.

This commit converts the ASIs which do "MMU passthrough".

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Tested-by: Mark Cave-Ayland <address@hidden>
Message-id: address@hidden


  Commit: 776095d3cd751a58469b68f652c1ab6785f63652
      
https://github.com/qemu/qemu/commit/776095d3cd751a58469b68f652c1ab6785f63652
  Author: Peter Maydell <address@hidden>
  Date:   2019-09-17 (Tue, 17 Sep 2019)

  Changed paths:
    M target/sparc/ldst_helper.c

  Log Message:
  -----------
  target/sparc: Check for transaction failures in MXCC stream ASI accesses

Currently the ld/st_asi helper functions make calls to the
ld*_phys() and st*_phys() functions for those ASIs which
imply direct accesses to physical addresses. These implicitly
rely on the unassigned_access hook to cause them to generate
an MMU fault if the access fails.

Switch to using the address_space_* functions instead, which
return a MemTxResult that we can check. This means that when
we switch SPARC over to using the do_transaction_failed hook
we'll still get the same MMU faults we did before.

This commit converts the ASIs which do MXCC stream source
and destination accesses.

It's not clear to me whether raising an MMU fault like this
is the correct behaviour if we encounter a bus error, but
we retain the same behaviour that the old unassigned_access
hook would implement.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Tested-by: Mark Cave-Ayland <address@hidden>
Message-id: address@hidden


  Commit: 3c818dfcc271f5ba298b06f33466ab30f9a28349
      
https://github.com/qemu/qemu/commit/3c818dfcc271f5ba298b06f33466ab30f9a28349
  Author: Peter Maydell <address@hidden>
  Date:   2019-09-17 (Tue, 17 Sep 2019)

  Changed paths:
    M target/sparc/mmu_helper.c

  Log Message:
  -----------
  target/sparc: Correctly handle bus errors in page table walks

Currently we use the ldl_phys() function to read page table entries.
With the unassigned_access hook in place, if these hit an unassigned
area of memory then the hook will cause us to wrongly generate
an exception with a fault address matching the address of the
page table entry.

Change to using address_space_ldl() so we can detect and correctly
handle bus errors and give them their correct behaviour of
causing a translation error with a suitable fault status register.

Note that this won't actually take effect until we switch the
over to using the do_translation_failed hook.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Tested-by: Mark Cave-Ayland <address@hidden>
Message-id: address@hidden


  Commit: d86a9ad33c75ed795f09fb43243d0acecd583f24
      
https://github.com/qemu/qemu/commit/d86a9ad33c75ed795f09fb43243d0acecd583f24
  Author: Peter Maydell <address@hidden>
  Date:   2019-09-17 (Tue, 17 Sep 2019)

  Changed paths:
    M target/sparc/mmu_helper.c

  Log Message:
  -----------
  target/sparc: Handle bus errors in mmu_probe()

Convert the mmu_probe() function to using address_space_ldl()
rather than ldl_phys(), so we can explicitly detect memory
transaction failures.

This makes no practical difference at the moment, because
ldl_phys() will return 0 on a transaction failure, and we
treat transaction failures and 0 PDEs identically. However
the spec says that MMU probe operations are supposed to
update the fault status registers, and if we ever implement
that we'll want to distinguish the difference. For the
moment, just add a TODO comment about the bug.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Tested-by: Mark Cave-Ayland <address@hidden>
Message-id: address@hidden


  Commit: 9dffeec2e003a482ca858a887d3454c6bebed91e
      
https://github.com/qemu/qemu/commit/9dffeec2e003a482ca858a887d3454c6bebed91e
  Author: Peter Maydell <address@hidden>
  Date:   2019-09-17 (Tue, 17 Sep 2019)

  Changed paths:
    M target/sparc/mmu_helper.c

  Log Message:
  -----------
  target/sparc: Remove unused ldl_phys from dump_mmu()

The dump_mmu() function does a ldl_phys() at the start, but
then never uses the value it loads at all. Remove the
unused code.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Tested-by: Mark Cave-Ayland <address@hidden>
Message-id: address@hidden


  Commit: f8c3db33a5e863291182f8862ddf81618a7c6194
      
https://github.com/qemu/qemu/commit/f8c3db33a5e863291182f8862ddf81618a7c6194
  Author: Peter Maydell <address@hidden>
  Date:   2019-09-17 (Tue, 17 Sep 2019)

  Changed paths:
    M target/sparc/cpu.c
    M target/sparc/cpu.h
    M target/sparc/ldst_helper.c

  Log Message:
  -----------
  target/sparc: Switch to do_transaction_failed() hook

Switch the SPARC target from the old unassigned_access hook to the
new do_transaction_failed hook.

This will cause the "if transaction failed" code paths added in
the previous commits to become active if the access is to an
unassigned address. In particular we'll now handle bus errors
during page table walks correctly (generating a translation
error with the right kind of fault status).

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Tested-by: Mark Cave-Ayland <address@hidden>
Message-id: address@hidden


Compare: https://github.com/qemu/qemu/compare/186c0ab9b98d...f8c3db33a5e8



reply via email to

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