From 8e2be6908cd08ab5f7f8c2ca37c1781472285223 Mon Sep 17 00:00:00 2001 From: DH Date: Sun, 12 Nov 2023 01:34:08 +0300 Subject: [PATCH] [amdgpu] bridge: avoid races --- .../bridge/include/amdgpu/bridge/bridge.hpp | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/hw/amdgpu/bridge/include/amdgpu/bridge/bridge.hpp b/hw/amdgpu/bridge/include/amdgpu/bridge/bridge.hpp index 0c8de8ccf..cde00b69b 100644 --- a/hw/amdgpu/bridge/include/amdgpu/bridge/bridge.hpp +++ b/hw/amdgpu/bridge/include/amdgpu/bridge/bridge.hpp @@ -147,18 +147,25 @@ struct BridgePusher { header->flags | static_cast(BridgeFlags::VmConfigured); } - void sendMemoryProtect(std::uint32_t pid, std::uint64_t address, std::uint64_t size, - std::uint32_t prot) { - sendCommand(CommandId::ProtectMemory, {pid, address, size, prot}); + void sendMemoryProtect(std::uint32_t pid, std::uint64_t address, + std::uint64_t size, std::uint32_t prot) { + if (pid == 50001) { + sendCommand(CommandId::ProtectMemory, {pid, address, size, prot}); + } } - void sendCommandBuffer(std::uint32_t pid, std::uint64_t queue, std::uint64_t address, - std::uint64_t size) { - sendCommand(CommandId::CommandBuffer, {pid, queue, address, size}); + void sendCommandBuffer(std::uint32_t pid, std::uint64_t queue, + std::uint64_t address, std::uint64_t size) { + if (pid == 50001) { + sendCommand(CommandId::CommandBuffer, {pid, queue, address, size}); + } } - void sendFlip(std::uint32_t pid, std::uint32_t bufferIndex, std::uint64_t arg) { - sendCommand(CommandId::Flip, {pid, bufferIndex, arg}); + void sendFlip(std::uint32_t pid, std::uint32_t bufferIndex, + std::uint64_t arg) { + if (pid == 50001) { + sendCommand(CommandId::Flip, {pid, bufferIndex, arg}); + } } void wait() {