multi-process: PCI BAR read/write handling for proxy & remote endpoints

Proxy device object implements handler for PCI BAR writes and reads.
The handler uses BAR_WRITE/BAR_READ message to communicate to the
remote process with the BAR address and value to be written/read.
The remote process implements handler for BAR_WRITE/BAR_READ
message.

Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: a8b76714a9688be5552c4c92d089bc9e8a4707ff.1611938319.git.jag.raman@oracle.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Jagannathan Raman 2021-01-29 11:46:17 -05:00 committed by Stefan Hajnoczi
parent 11ab872588
commit 7ee3f82384
5 changed files with 168 additions and 0 deletions

View file

@ -37,6 +37,8 @@ typedef enum {
MPQEMU_CMD_RET,
MPQEMU_CMD_PCI_CFGWRITE,
MPQEMU_CMD_PCI_CFGREAD,
MPQEMU_CMD_BAR_WRITE,
MPQEMU_CMD_BAR_READ,
MPQEMU_CMD_MAX,
} MPQemuCmd;
@ -52,6 +54,13 @@ typedef struct {
int len;
} PciConfDataMsg;
typedef struct {
hwaddr addr;
uint64_t val;
unsigned size;
bool memory;
} BarAccessMsg;
/**
* MPQemuMsg:
* @cmd: The remote command
@ -71,6 +80,7 @@ typedef struct {
uint64_t u64;
PciConfDataMsg pci_conf_data;
SyncSysmemMsg sync_sysmem;
BarAccessMsg bar_access;
} data;
int fds[REMOTE_MAX_FDS];

View file

@ -15,6 +15,14 @@
#define TYPE_PCI_PROXY_DEV "x-pci-proxy-dev"
OBJECT_DECLARE_SIMPLE_TYPE(PCIProxyDev, PCI_PROXY_DEV)
typedef struct ProxyMemoryRegion {
PCIProxyDev *dev;
MemoryRegion mr;
bool memory;
bool present;
uint8_t type;
} ProxyMemoryRegion;
struct PCIProxyDev {
PCIDevice parent_dev;
char *fd;
@ -28,6 +36,7 @@ struct PCIProxyDev {
QemuMutex io_mutex;
QIOChannel *ioc;
Error *migration_blocker;
ProxyMemoryRegion region[PCI_NUM_REGIONS];
};
#endif /* PROXY_H */