[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 07/48] ivshmem: remove superflous ivshmem_attr fi
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v5 07/48] ivshmem: remove superflous ivshmem_attr field |
Date: |
Fri, 2 Oct 2015 21:09:10 +0200 |
From: Marc-André Lureau <address@hidden>
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Claudio Fontana <address@hidden>
---
hw/misc/ivshmem.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index fbeb731..7138b8d 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -85,7 +85,6 @@ typedef struct IVShmemState {
MemoryRegion bar;
MemoryRegion ivshmem;
uint64_t ivshmem_size; /* size of shared memory region */
- uint32_t ivshmem_attr;
uint32_t ivshmem_64bit;
int shm_fd; /* shared memory file descriptor */
@@ -345,7 +344,7 @@ static int check_shm_size(IVShmemState *s, int fd) {
/* create the shared memory BAR when we are not using the server, so we can
* create the BAR and map the memory immediately */
-static void create_shared_memory_BAR(IVShmemState *s, int fd) {
+static void create_shared_memory_BAR(IVShmemState *s, int fd, uint8_t attr) {
void * ptr;
@@ -359,7 +358,7 @@ static void create_shared_memory_BAR(IVShmemState *s, int
fd) {
memory_region_add_subregion(&s->bar, 0, &s->ivshmem);
/* region for shared memory */
- pci_register_bar(PCI_DEVICE(s), 2, s->ivshmem_attr, &s->bar);
+ pci_register_bar(PCI_DEVICE(s), 2, attr, &s->bar);
}
static void ivshmem_add_eventfd(IVShmemState *s, int posn, int i)
@@ -714,6 +713,8 @@ static int pci_ivshmem_init(PCIDevice *dev)
{
IVShmemState *s = IVSHMEM(dev);
uint8_t *pci_conf;
+ uint8_t attr = PCI_BASE_ADDRESS_SPACE_MEMORY |
+ PCI_BASE_ADDRESS_MEM_PREFETCH;
if (s->sizearg == NULL)
s->ivshmem_size = 4 << 20; /* 4 MB default */
@@ -768,10 +769,8 @@ static int pci_ivshmem_init(PCIDevice *dev)
&s->ivshmem_mmio);
memory_region_init(&s->bar, OBJECT(s), "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;
+ attr |= PCI_BASE_ADDRESS_MEM_TYPE_64;
}
if ((s->server_chr != NULL) &&
@@ -798,7 +797,7 @@ static int pci_ivshmem_init(PCIDevice *dev)
/* allocate/initialize space for interrupt handling */
s->peers = g_malloc0(s->nb_peers * sizeof(Peer));
- pci_register_bar(dev, 2, s->ivshmem_attr, &s->bar);
+ pci_register_bar(dev, 2, attr, &s->bar);
s->eventfd_chr = g_malloc0(s->vectors * sizeof(CharDriverState *));
@@ -835,8 +834,7 @@ static int pci_ivshmem_init(PCIDevice *dev)
exit(1);
}
- create_shared_memory_BAR(s, fd);
-
+ create_shared_memory_BAR(s, fd, attr);
}
dev->config_write = ivshmem_write_config;
--
2.4.3
- [Qemu-devel] [PATCH v5 20/48] ivshmem: simplify a bit the code, (continued)
- [Qemu-devel] [PATCH v5 20/48] ivshmem: simplify a bit the code, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 30/48] ivshmem: reset mask on device reset, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 28/48] ivshmem: replace 'guest' for 'peer' appropriately, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 37/48] contrib: remove unnecessary strdup(), marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 42/48] ivshmem: do not keep shm_fd open, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 38/48] msix: implement pba write (but read-only), marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 45/48] ivshmem: remove EventfdEntry.vector, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 48/48] ivshmem: use little-endian int64_t for the protocol, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 04/48] ivshmem: fix number of bytes to push to fifo, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 07/48] ivshmem: remove superflous ivshmem_attr field,
marcandre . lureau <=
- [Qemu-devel] [PATCH v5 05/48] ivshmem: factor out the incoming fifo handling, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 09/48] ivshmem: more qdev conversion, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 10/48] ivshmem: remove last exit(1), marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 15/48] ivshmem: initialize max_peer to -1, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 21/48] ivshmem: use common return, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 44/48] ivshmem: add hostmem backend, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 32/48] ivshmem-client: check the number of vectors, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 47/48] ivshmem: use kvm irqfd for msi notifications, marcandre . lureau, 2015/10/08