ivshmem: add 64bit option
This patch adds a "use64" property which will make the ivshmem driver register a 64bit memory bar when set, so you have something to play with when testing 64bit pci bits. It also allows to have quite big shared memory regions, like this: [root@fedora ~]# lspci -vs1:1 01:01.0 RAM memory: Red Hat, Inc Device 1110 Subsystem: Red Hat, Inc Device 1100 Physical Slot: 1-1 Flags: fast devsel Memory at fd400000 (32-bit, non-prefetchable) [disabled] [size=256] Memory at 8040000000 (64-bit, prefetchable) [size=1G] [ v5: rebase, update compat property for post-1.2 merge ] [ v4: rebase & adapt to latest master again ] [ v3: rebase & adapt to latest master ] [ v2: default to on as suggested by avi, turn off for pc-$old using compat property ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Tested-by: Cam Macdonell <cam@cs.ualberta.ca> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
183c5eaa41
commit
c08ba66f13
13
hw/ivshmem.c
13
hw/ivshmem.c
@ -71,6 +71,8 @@ typedef struct IVShmemState {
|
|||||||
MemoryRegion bar;
|
MemoryRegion bar;
|
||||||
MemoryRegion ivshmem;
|
MemoryRegion ivshmem;
|
||||||
uint64_t ivshmem_size; /* size of shared memory region */
|
uint64_t ivshmem_size; /* size of shared memory region */
|
||||||
|
uint32_t ivshmem_attr;
|
||||||
|
uint32_t ivshmem_64bit;
|
||||||
int shm_fd; /* shared memory file descriptor */
|
int shm_fd; /* shared memory file descriptor */
|
||||||
|
|
||||||
Peer *peers;
|
Peer *peers;
|
||||||
@ -339,7 +341,7 @@ static void create_shared_memory_BAR(IVShmemState *s, int fd) {
|
|||||||
memory_region_add_subregion(&s->bar, 0, &s->ivshmem);
|
memory_region_add_subregion(&s->bar, 0, &s->ivshmem);
|
||||||
|
|
||||||
/* region for shared memory */
|
/* region for shared memory */
|
||||||
pci_register_bar(&s->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
|
pci_register_bar(&s->dev, 2, s->ivshmem_attr, &s->bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ivshmem_add_eventfd(IVShmemState *s, int posn, int i)
|
static void ivshmem_add_eventfd(IVShmemState *s, int posn, int i)
|
||||||
@ -690,6 +692,11 @@ static int pci_ivshmem_init(PCIDevice *dev)
|
|||||||
&s->ivshmem_mmio);
|
&s->ivshmem_mmio);
|
||||||
|
|
||||||
memory_region_init(&s->bar, "ivshmem-bar2-container", s->ivshmem_size);
|
memory_region_init(&s->bar, "ivshmem-bar2-container", s->ivshmem_size);
|
||||||
|
s->ivshmem_attr = PCI_BASE_ADDRESS_SPACE_MEMORY |
|
||||||
|
PCI_BASE_ADDRESS_MEM_PREFETCH;
|
||||||
|
if (s->ivshmem_64bit) {
|
||||||
|
s->ivshmem_attr |= PCI_BASE_ADDRESS_MEM_TYPE_64;
|
||||||
|
}
|
||||||
|
|
||||||
if ((s->server_chr != NULL) &&
|
if ((s->server_chr != NULL) &&
|
||||||
(strncmp(s->server_chr->filename, "unix:", 5) == 0)) {
|
(strncmp(s->server_chr->filename, "unix:", 5) == 0)) {
|
||||||
@ -715,8 +722,7 @@ static int pci_ivshmem_init(PCIDevice *dev)
|
|||||||
/* allocate/initialize space for interrupt handling */
|
/* allocate/initialize space for interrupt handling */
|
||||||
s->peers = g_malloc0(s->nb_peers * sizeof(Peer));
|
s->peers = g_malloc0(s->nb_peers * sizeof(Peer));
|
||||||
|
|
||||||
pci_register_bar(&s->dev, 2,
|
pci_register_bar(&s->dev, 2, s->ivshmem_attr, &s->bar);
|
||||||
PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
|
|
||||||
|
|
||||||
s->eventfd_chr = g_malloc0(s->vectors * sizeof(CharDriverState *));
|
s->eventfd_chr = g_malloc0(s->vectors * sizeof(CharDriverState *));
|
||||||
|
|
||||||
@ -786,6 +792,7 @@ static Property ivshmem_properties[] = {
|
|||||||
DEFINE_PROP_BIT("msi", IVShmemState, features, IVSHMEM_MSI, true),
|
DEFINE_PROP_BIT("msi", IVShmemState, features, IVSHMEM_MSI, true),
|
||||||
DEFINE_PROP_STRING("shm", IVShmemState, shmobj),
|
DEFINE_PROP_STRING("shm", IVShmemState, shmobj),
|
||||||
DEFINE_PROP_STRING("role", IVShmemState, role),
|
DEFINE_PROP_STRING("role", IVShmemState, role),
|
||||||
|
DEFINE_PROP_UINT32("use64", IVShmemState, ivshmem_64bit, 1),
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -367,6 +367,10 @@ static QEMUMachine pc_machine_v1_3 = {
|
|||||||
.driver = "nec-usb-xhci",\
|
.driver = "nec-usb-xhci",\
|
||||||
.property = "msix",\
|
.property = "msix",\
|
||||||
.value = "off",\
|
.value = "off",\
|
||||||
|
},{\
|
||||||
|
.driver = "ivshmem",\
|
||||||
|
.property = "use64",\
|
||||||
|
.value = "0",\
|
||||||
}
|
}
|
||||||
|
|
||||||
static QEMUMachine pc_machine_v1_2 = {
|
static QEMUMachine pc_machine_v1_2 = {
|
||||||
|
Loading…
Reference in New Issue
Block a user