[common/idd] recovery: reserve IVSHMEM control region

Define a fixed, protocol-independent recovery ABI in the final 64 KiB
of IVSHMEM.

Provide crash-safe multi-client requests and coherent producer status.

Exclude the region from LGMP allocation and frame capacity so future
protocol mismatches retain a stable control path.
This commit is contained in:
Geoffrey McRae
2026-08-11 22:08:34 +10:00
parent 61a49ebaba
commit 9898e9bcec
5 changed files with 285 additions and 6 deletions

View File

@@ -24,6 +24,8 @@
#include <SetupAPI.h>
#include <vector>
#include "common/KVMFRRecovery.h"
class CIVSHMEM
{
private:
@@ -46,6 +48,21 @@ public:
bool Open();
void Close();
size_t GetSize() const { return m_size; }
void * GetMem () const { return m_mem; }
size_t GetFullSize () const { return m_size; }
size_t GetUsableSize () const
{
if (m_size < KVMFR_R_REGION_SIZE)
return 0;
return m_size - KVMFR_R_REGION_SIZE;
}
void * GetMem () const { return m_mem; }
void * GetRecoveryMem () const
{
if (!m_mem || m_size < KVMFR_R_REGION_SIZE)
return nullptr;
return static_cast<uint8_t *>(m_mem) + GetUsableSize();
}
};