target/sparc: Stop using the legacy ldst_phys() API
cover target/sparc: Stop using the legacy ldst_phys() API
Remove the last ldst_phys() API call on SPARC.
Philippe Mathieu-Daudé (2):
target/sparc: Replace legacy st_phys() -> address_space_st() configs/targets: Restrict legacy ldst_phys() API on 32-bit SPARC
target
configs/targets/sparc-softmmu.mak | 1 + target/sparc/mmu_helper.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
Signature · 1 line
2.52.0
PATCH 1/2 target/sparc: Replace legacy st_phys() -> address_space_st()
Prefer the address_space_ld/st API over the legacy ld_phys() because it allow checking for bus access fault.
get_physical_address() already accessed the PTE stored at %pde_ptr and is going to update it. Assume the address space is also writeable there. The SPARC v8 manual only mentions faults (with error condition bits updated) in the READ path but not on the WRITE (update) one.
--- target/sparc/mmu_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/sparc/mmu_helper.c +3 -1
@@ -190,7 +190,9 @@ static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full,if (is_dirty) { pde |=PG_MODIFIED_MASK ; } -stl_be_phys (cs->as, pde_ptr, pde); +address_space_stl_be (cs->as, pde_ptr, pde, +MEMTXATTRS_UNSPECIFIED , &result); +assert (result ==MEMTX_OK ); }/* the page can be put in the TLB */
Signature · 1 line
2.52.0
Re: [PATCH 1/2] target/sparc: Replace legacy st_phys() -> address_space_st()
Quoted 19 lines · Philippe Mathieu-Daudé
Prefer the address_space_ld/st API over the legacy
ld_phys()because it allow checking for bus access fault.
get_physical_address()already accessed the PTE stored at %pde_ptr and is going to update it. Assume the address space is also writeable there. The SPARC v8 manual only mentions faults (with error condition bits updated) in the READ path but not on the WRITE (update) one.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/sparc/mmu_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)target/sparc/mmu_helper.c +0
-0
target/sparc/mmu_helper.c static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full, · line 198
Quoted 10 lines
target/sparc/mmu_helper.c +3
-1@@ -190,7 +190,9 @@ static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full,if (is_dirty) { pde |=PG_MODIFIED_MASK ; } -stl_be_phys (cs->as, pde_ptr, pde); +address_space_stl_be (cs->as, pde_ptr, pde, +MEMTXATTRS_UNSPECIFIED , &result); +assert (result ==MEMTX_OK ); }/* the page can be put in the TLB */
r~
PATCH 2/2 configs/targets: Restrict legacy ldst_phys() API on 32-bit SPARC target
In reply to Philippe Mathieu-DaudéSince we removed the last legacy uses of the legacy ldst_phys() API, set the TARGET_NOT_USING_LEGACY_LDST_PHYS_API variable to hide the legacy API to the qemu-system-sparc binary, avoiding further API uses to creep in.
--- configs/targets/sparc-softmmu.mak | 1 + 1 file changed, 1 insertion(+)
configs/targets/sparc-softmmu.mak +1 -0
@@ -1,4 +1,5 @@ TARGET_ARCH=sparc TARGET_BIG_ENDIAN=y TARGET_LONG_BITS=32 +TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y
Signature · 1 line
2.52.0
Re: [PATCH 2/2] configs/targets: Restrict legacy ldst_phys() API on 32-bit SPARC target
Quoted 15 lines · Philippe Mathieu-Daudé
Since we removed the last legacy uses of the legacy
ldst_phys()API, set theTARGET_NOT_USING_LEGACY_LDST_PHYS_APIvariable to hide the legacy API to the qemu-system-sparc binary, avoiding further API uses to creep in.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- configs/targets/sparc-softmmu.mak | 1 + 1 file changed, 1 insertion(+)configs/targets/sparc-softmmu.mak +0
-0
configs/targets/sparc-softmmu.mak line 5
Quoted 5 lines
configs/targets/sparc-softmmu.mak +1
-0@@ -1,4 +1,5 @@ TARGET_ARCH=sparc TARGET_BIG_ENDIAN=y TARGET_LONG_BITS=32 +TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y
r~
Quoted 4 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (2):
target/sparc: Replace legacyst_phys()->address_space_st()configs/targets: Restrict legacyldst_phys()API on 32-bit SPARC
target
Series queued, thanks.