* [Qemu-devel] [PATCH] ivshmem: add 64bit option
@ 2012-07-12 15:08 Gerd Hoffmann
2012-08-08 8:14 ` Gerd Hoffmann
2012-08-21 18:35 ` Cam Macdonell
0 siblings, 2 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2012-07-12 15:08 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
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]
[ 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>
---
hw/ivshmem.c | 13 ++++++++++---
hw/pc_piix.c | 4 ++++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index 05559b6..8a776e2 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -72,6 +72,8 @@ typedef struct IVShmemState {
MemoryRegion ivshmem;
MemoryRegion msix_bar;
uint64_t ivshmem_size; /* size of shared memory region */
+ uint32_t ivshmem_attr;
+ uint32_t ivshmem_64bit;
int shm_fd; /* shared memory file descriptor */
Peer *peers;
@@ -344,7 +346,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(&s->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
+ pci_register_bar(&s->dev, 2, s->ivshmem_attr, &s->bar);
}
static void close_guest_eventfds(IVShmemState *s, int posn)
@@ -693,6 +695,11 @@ static int pci_ivshmem_init(PCIDevice *dev)
&s->ivshmem_mmio);
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) &&
(strncmp(s->server_chr->filename, "unix:", 5) == 0)) {
@@ -718,8 +725,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(&s->dev, 2,
- PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
+ pci_register_bar(&s->dev, 2, s->ivshmem_attr, &s->bar);
s->eventfd_chr = g_malloc0(s->vectors * sizeof(CharDriverState *));
@@ -791,6 +797,7 @@ static Property ivshmem_properties[] = {
DEFINE_PROP_BIT("msi", IVShmemState, features, IVSHMEM_MSI, true),
DEFINE_PROP_STRING("shm", IVShmemState, shmobj),
DEFINE_PROP_STRING("role", IVShmemState, role),
+ DEFINE_PROP_UINT32("use64", IVShmemState, ivshmem_64bit, 1),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 0c0096f..5101f5d 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -375,6 +375,10 @@ static QEMUMachine pc_machine_v1_2 = {
.driver = "qxl",\
.property = "vgamem_mb",\
.value = stringify(8),\
+ },{\
+ .driver = "ivshmem",\
+ .property = "use64",\
+ .value = "0",\
}
static QEMUMachine pc_machine_v1_1 = {
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] ivshmem: add 64bit option
2012-07-12 15:08 [Qemu-devel] [PATCH] ivshmem: add 64bit option Gerd Hoffmann
@ 2012-08-08 8:14 ` Gerd Hoffmann
2012-08-21 18:35 ` Cam Macdonell
1 sibling, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2012-08-08 8:14 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On 07/12/12 17:08, Gerd Hoffmann wrote:
> 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:
Ping?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] ivshmem: add 64bit option
2012-07-12 15:08 [Qemu-devel] [PATCH] ivshmem: add 64bit option Gerd Hoffmann
2012-08-08 8:14 ` Gerd Hoffmann
@ 2012-08-21 18:35 ` Cam Macdonell
1 sibling, 0 replies; 4+ messages in thread
From: Cam Macdonell @ 2012-08-21 18:35 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
Thanks Gerd,
might need another rebase. I have had some users request larger memory regions.
Quoting Gerd Hoffmann <kraxel@redhat.com>:
> 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]
>
> [ 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>
> ---
> hw/ivshmem.c | 13 ++++++++++---
> hw/pc_piix.c | 4 ++++
> 2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/hw/ivshmem.c b/hw/ivshmem.c
> index 05559b6..8a776e2 100644
> --- a/hw/ivshmem.c
> +++ b/hw/ivshmem.c
> @@ -72,6 +72,8 @@ typedef struct IVShmemState {
> MemoryRegion ivshmem;
> MemoryRegion msix_bar;
> uint64_t ivshmem_size; /* size of shared memory region */
> + uint32_t ivshmem_attr;
> + uint32_t ivshmem_64bit;
> int shm_fd; /* shared memory file descriptor */
>
> Peer *peers;
> @@ -344,7 +346,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(&s->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
> + pci_register_bar(&s->dev, 2, s->ivshmem_attr, &s->bar);
> }
>
> static void close_guest_eventfds(IVShmemState *s, int posn)
> @@ -693,6 +695,11 @@ static int pci_ivshmem_init(PCIDevice *dev)
> &s->ivshmem_mmio);
>
> 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) &&
> (strncmp(s->server_chr->filename, "unix:", 5) == 0)) {
> @@ -718,8 +725,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(&s->dev, 2,
> - PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
> + pci_register_bar(&s->dev, 2, s->ivshmem_attr, &s->bar);
>
> s->eventfd_chr = g_malloc0(s->vectors * sizeof(CharDriverState *));
>
> @@ -791,6 +797,7 @@ static Property ivshmem_properties[] = {
> DEFINE_PROP_BIT("msi", IVShmemState, features, IVSHMEM_MSI, true),
> DEFINE_PROP_STRING("shm", IVShmemState, shmobj),
> DEFINE_PROP_STRING("role", IVShmemState, role),
> + DEFINE_PROP_UINT32("use64", IVShmemState, ivshmem_64bit, 1),
> DEFINE_PROP_END_OF_LIST(),
> };
>
> diff --git a/hw/pc_piix.c b/hw/pc_piix.c
> index 0c0096f..5101f5d 100644
> --- a/hw/pc_piix.c
> +++ b/hw/pc_piix.c
> @@ -375,6 +375,10 @@ static QEMUMachine pc_machine_v1_2 = {
> .driver = "qxl",\
> .property = "vgamem_mb",\
> .value = stringify(8),\
> + },{\
> + .driver = "ivshmem",\
> + .property = "use64",\
> + .value = "0",\
> }
>
> static QEMUMachine pc_machine_v1_1 = {
> --
> 1.7.1
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH] ivshmem: add 64bit option
@ 2012-05-03 7:47 Gerd Hoffmann
0 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2012-05-03 7:47 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
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]
[ v2: default to on as suggested by avi,
turn off for pc-$old using compat property ]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/ivshmem.c | 13 ++++++++++---
hw/pc_piix.c | 4 ++++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index d48e5f9..5d10dff 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -72,6 +72,8 @@ typedef struct IVShmemState {
MemoryRegion ivshmem;
MemoryRegion msix_bar;
uint64_t ivshmem_size; /* size of shared memory region */
+ uint32_t ivshmem_attr;
+ uint32_t ivshmem_64bit;
int shm_fd; /* shared memory file descriptor */
Peer *peers;
@@ -344,7 +346,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(&s->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
+ pci_register_bar(&s->dev, 2, s->ivshmem_attr, &s->bar);
}
static void close_guest_eventfds(IVShmemState *s, int posn)
@@ -694,6 +696,11 @@ static int pci_ivshmem_init(PCIDevice *dev)
&s->ivshmem_mmio);
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) &&
(strncmp(s->server_chr->filename, "unix:", 5) == 0)) {
@@ -719,8 +726,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(&s->dev, 2,
- PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
+ pci_register_bar(&s->dev, 2, s->ivshmem_attr, &s->bar);
s->eventfd_chr = g_malloc0(s->vectors * sizeof(CharDriverState *));
@@ -792,6 +798,7 @@ static Property ivshmem_properties[] = {
DEFINE_PROP_BIT("msi", IVShmemState, features, IVSHMEM_MSI, true),
DEFINE_PROP_STRING("shm", IVShmemState, shmobj),
DEFINE_PROP_STRING("role", IVShmemState, role),
+ DEFINE_PROP_UINT32("use64", IVShmemState, ivshmem_64bit, 1),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 27f990f..3b1ed76 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -379,6 +379,10 @@ static QEMUMachine pc_machine_v1_1 = {
.driver = "USB",\
.property = "full-path",\
.value = "no",\
+ },{\
+ .driver = "ivshmem",\
+ .property = "use64",\
+ .value = "0",\
}
static QEMUMachine pc_machine_v1_0 = {
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-21 18:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-12 15:08 [Qemu-devel] [PATCH] ivshmem: add 64bit option Gerd Hoffmann
2012-08-08 8:14 ` Gerd Hoffmann
2012-08-21 18:35 ` Cam Macdonell
-- strict thread matches above, loose matches on Subject: below --
2012-05-03 7:47 Gerd Hoffmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.