Commit graph

640 commits

Author SHA1 Message Date
Nekotekina
771eff273b First part of fixing sign-compare warning (inside be_t). 2020-02-19 22:54:58 +03:00
Eladash
df8d0cde4a RSX/SPU: Accurate reservation access 2020-02-19 18:11:30 +00:00
Eladash
727d783959 RawSPU: protect NPC from writes/reads in running state 2020-02-18 18:09:10 +00:00
Eladash
fad8b38b28 sys_spu: protect sys_spu_image members in kernel mode
Save relevant info in idm, set sys_spu_image segs and nsegs members to 0.
2020-02-18 18:09:10 +00:00
Megamouse
fe75311be2 move config structs to own files and clean up some headers 2020-02-17 15:08:17 +03:00
eladash
f901846acb RawSPU: execute MFC proxy cmd after reading CMDStatus
Implement MFC proxy argument sequence checking.
2020-02-06 20:43:38 +00:00
Eladash
37513b1898 SPU reservations: Do not access violate under vm::writer_lock
TODO: Throw exception when encountering page faults notification enabled memory
2020-02-06 00:27:17 +00:00
Eladash
f8b3c48af7
sys_spu: Implement proper SPU group flags (#7320)
* sys_spu: Implement proper SPU group flags
2020-02-05 20:46:05 +00:00
Eladash
049e392a97 Make preferred spu threads dynamically adjustable 2020-02-05 10:06:07 +00:00
Nekotekina
c0f80cfe7a Use attributes for LIKELY/UNLIKELY
Remove LIKELY/UNLIKELY macro.
2020-02-05 10:42:34 +03:00
Nekotekina
6dfd97f0b6 Modernize SPU logging (spu_log variable) and remove log legacy
Remove legacy macro (LOG_ERROR, etc)
2020-02-01 11:52:52 +03:00
Eladash
fe381b8581 SPU: Add SPU LS to debugger 2020-01-21 16:45:41 +03:00
Nekotekina
ddda09607d SPU: fixup for STOP 0w0 2020-01-21 16:32:00 +03:00
Eladash
9993df9b8b RawSPU: fix race between spu start and stop
This race could lead to spu status bits indicate RUNNING status, but cpu state being stopped.
Fix it by making sure cpu state is set before spu status.
2020-01-21 14:08:39 +03:00
Nekotekina
98a8eeaac2 SPU: properly support STOP 0x0 instruction 2020-01-20 23:40:10 +03:00
Eladash
765bd6b6c6 SPU: Optimize gpr reset for MSVC 2020-01-11 22:56:46 +03:00
Eladash
b59a825e48 Minor fixup after #6894 2019-12-30 23:46:45 +03:00
Eladash
45cff1219c Allow sys_raw_spu_create_tag to be called more than once 2019-12-30 23:46:45 +03:00
Eladash
5631382623 sys_spu: Fix SPU Thread Id
* Removed wrong code in sys_spu_thread_group_terminate.
* SPU Thread ID is accurate, including 5th thread id "rule".
* Fixed possible use-after-free access of spu_thread::group member.
* RawSPU ID management simplified.
2019-12-06 19:59:29 +03:00
Nekotekina
185c067d5b C-style cast cleanup V 2019-12-03 17:23:00 +03:00
Markus Stockhausen
cd6b6c8a4f Lightweight putllc() for non-TSX if no data changed
This replaces the totally messed up PR #6728

Some games make heavy use of getllar() & putllc() without even changing data.
In this case avoid unneccesary heavy locking of the PPU threads on non-TSX
hosts.
2019-11-19 18:10:29 +03:00
Nekotekina
ccac9d4777 Remove throwing and catching cpu_flag::stop
Since there is spu_runtime::g_escape function now.
2019-11-08 19:27:11 +03:00
Eladash
f41f5054f7 sys_spu Fixup after #6864 2019-10-29 23:13:16 +03:00
Eladash
b99992d570 sys_spu: Fix SNR and Inbound Mailbox state reset
Also remove bugged ESTAT check at sys_spu_thread_write_spu_mb.
2019-10-29 18:34:28 +03:00
Nekotekina
9ac6ef6494 SPU: cleanup former OOM handling
Remove cpu_flag::jit_return.
It's obsolete now, and worked only in SPU ASMJIT anyway.
2019-10-26 21:24:12 +03:00
MSuih
f3ed26e9db Small warnings cleanup (#6671)
* Ignore more warnings

These are intentional

* Signed/unsigned mismatch when comparing

* Explictly cast values

* Intentionally discard a nodiscard value

* Change ppu_tid to u32

* Do not use POSIX function name on Windows

* Qt: Use horizontalAdvance instead of width

* Change progress variables to u32
2019-10-25 13:32:21 +03:00
Nekotekina
b329bb604c SPU LLVM: implemented asynchronous compilation
Implemented interpreter-based pre-recompiler.
Interpreter functions are build with SPU LLVM.
2019-10-21 19:29:34 +03:00
eladash
95752607ea sys_spu: Don't reset snr config at group_start()
Also first check for EINVAL in sys_spu_thread_set_spu_cfg
2019-10-16 21:11:29 +03:00
Nekotekina
49e96b39dd [SPU, TSX] Fix reservation corruption in PUTLLC
Change reservation locking logic.
2019-10-12 15:41:24 +03:00
Eladash
c2278fb879 spu: Mask SRR0 at write 2019-10-08 02:52:33 +03:00
Nekotekina
feee3838eb Revert "Revert "Remove shared_cond and simplify reservation waiting""
This reverts commit b70c08a2e8.
2019-09-24 05:01:00 +03:00
Nekotekina
b70c08a2e8 Revert "Remove shared_cond and simplify reservation waiting"
This reverts commit 0a96497e13.
2019-09-14 00:02:48 +03:00
Nekotekina
2fc8844315 atomic.hpp: add atomic wait mask support 2019-09-13 15:53:34 +03:00
Nekotekina
0a96497e13 Remove shared_cond and simplify reservation waiting
Use atomic wait for reservations
Cleanup some obsolete code
2019-09-10 19:25:39 +03:00
Eladash
0d88f037ff Add new accuracy control for PUTLLUC accuracy setting (non-TSX)
With the option enabled GET commands are blocked until the current PUTLLC/PUTLLUC executer on that address finishes

Additional improvements:
- Minor race fix of sys_ppu_thread_exit (wait until the writer finishes)
- Max number of ppu threads bumped to 8
2019-08-17 00:42:46 +03:00
Eladash
49aefc0795 Prefetch MFC list elements (#5345)
* Prefetch mfc list elemets to protect from overwriting

Also move some stuff away from command processing such as a few constant arguments setup
2019-07-24 01:13:45 +03:00
Nekotekina
cb5c26f2b5 Fix SPU Interpreter regression after #6147 2019-07-15 16:34:34 +03:00
Nekotekina
22e4ef147a SPU TSX: fix "Preferred SPU Threads" 2019-07-14 17:33:20 +03:00
Eladash
d7a2d42d8f MFC: Fix Tag Status report for sync/eieio/barrier commands 2019-07-10 17:35:39 +03:00
msuih
146e43b6ec Do not use negative unsigned literals 2019-07-01 04:33:23 +03:00
Eladash
43f919c04b Fixup after #6143 (#6146)
vm::spu max address was overflowing resulting in issues, so cast to u64 where needed. Fixes #6145.
    Use vm::get_addr instead of manually substructing vm::base(0) from pointer in texture cache code.
    Prefer std::atomic_thread_fence over _mm_?fence(), adjust usage to be more correct.
    Used sequantially consistent ordering in semaphore_release for TSX path as well.
    Improved memory ordering for sys_rsx_context_iounmap/map.
    Fixed sync bugs in HLE gcm because of not using atomic instructions.
    Use release memory barrier in lwsync for PPU LLVM, according to this xbox360 programming guide lwsync is a hw release memory barrier.
    Also use release barrier where lwsync was originally used in liblv2 sys_lwmutex and cellSync.
    Use acquire barrier for isync instruction, see https://devblogs.microsoft.com/oldnewthing/20180814-00/?p=99485
2019-06-29 18:48:42 +03:00
Eladash
1ee7b91646 Refactoring (#6143)
Prefer vm::ptr<>::ptr over vm::get_addr.
    Prefer vm::_ptr/base over vm::g_base_addr with offset.
    Added methods atomic_t<>::bts and atomic_t<>::btr .
    Removed obsolute rsx:🧵:Read/WriteIO32 methods.
    Removed wrong check in semaphore_release.
    Added handling for PUTRx commands for RawSPU MFC proxy.
    Prefer overloaded methods of v128 instead of _mm_... in VPKSHUS ppu interpreter precise.
    Fixed more potential overflows that may result in wrong behaviour.
    Added io/size alignment check for sys_rsx_context_iounmap.
    Added rsx::constants::local_mem_base which represents RSX local memory base address.
    Removed obsolute rsx:🧵:main_mem_addr/ioSize/ioAddress members.
2019-06-29 01:27:49 +03:00
JohnHolmesII
be521ff0ab Fix warnings related to parentheses 2019-06-25 20:36:32 -07:00
kd-11
4ff77a8555 rsx: Improve balancing of the offloader thread
- Use two counters to avoid atomic operations
- Yield instead of sleeping because some games are very sensitive to timing
2019-06-25 20:50:54 +03:00
Lassi Hämäläinen
499035512b Split Emu/Memory into more logical headers
- Add vm_locking.h and vm_reservation.h and move relevant functions
  and types to these headers.
- Change include order and make vm_ptr.h, vm_var.h and vm_ref.h headers
  usable invidually and them including vm.h instead of other way around
- Because usage of vm::ptr now requires including vm_ptr.h instead of
  vm.h updated multiple #includes
- Added additional #includes to vm_reservation.h and vm_locking to
  where vm::reservation_* and locking related functions are used
2019-06-25 17:11:10 +03:00
Nekotekina
b9b591bf02 Fix SPU Loop Detection 2019-06-20 14:46:32 +03:00
Nekotekina
5d45a3e47d Implement cpu_thread::suspend_all
Remove Accurate PUTLLC option.
Implement fallback path for SPU transactions.
2019-06-19 20:36:12 +03:00
Nekotekina
9dc0368079 Rename cond_x16 to shared_cond
Extend capacity from 16 to 32.
Remove redundant m_total counter.
2019-06-04 16:37:50 +03:00
scribam
790962425c Fix some "-Wpedantic" warnings 2019-06-01 22:59:23 +03:00
Nekotekina
71b71537a0 SPU TSX: implement Accurate PUTLLC option
Allow spurious PUTLLC failure if disabled (default).
2019-05-25 22:23:23 +03:00