diff mbox series

[1/2] hw/pci-host/x86: extract get_pci_hole64_start_value() helpers

Message ID 20180924221346.16733-2-lersek@redhat.com (mailing list archive)
State New, archived
Headers show
Series hw/pci-host/x86: extend the 64-bit PCI hole relative to the fw-assigned base | expand

Commit Message

Laszlo Ersek Sept. 24, 2018, 10:13 p.m. UTC
Expose the calculated "hole64 start" GPAs as plain uint64_t values,
extracting the internals of the current property getters.

This patch doesn't change behavior.

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 hw/pci-host/piix.c | 15 +++++++++++----
 hw/pci-host/q35.c  | 15 +++++++++++----
 2 files changed, 22 insertions(+), 8 deletions(-)

Comments

Marcel Apfelbaum Sept. 25, 2018, 5:56 p.m. UTC | #1
On 9/25/18 1:13 AM, Laszlo Ersek wrote:
> Expose the calculated "hole64 start" GPAs as plain uint64_t values,
> extracting the internals of the current property getters.
>
> This patch doesn't change behavior.
>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>   hw/pci-host/piix.c | 15 +++++++++++----
>   hw/pci-host/q35.c  | 15 +++++++++++----
>   2 files changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
> index 0e608347c1f0..0df91e002076 100644
> --- a/hw/pci-host/piix.c
> +++ b/hw/pci-host/piix.c
> @@ -249,9 +249,7 @@ static void i440fx_pcihost_get_pci_hole_end(Object *obj, Visitor *v,
>    * the 64bit PCI hole will start after "over 4G RAM" and the
>    * reserved space for memory hotplug if any.
>    */
> -static void i440fx_pcihost_get_pci_hole64_start(Object *obj, Visitor *v,
> -                                                const char *name,
> -                                                void *opaque, Error **errp)
> +static uint64_t i440fx_pcihost_get_pci_hole64_start_value(Object *obj)
>   {
>       PCIHostState *h = PCI_HOST_BRIDGE(obj);
>       I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
> @@ -263,7 +261,16 @@ static void i440fx_pcihost_get_pci_hole64_start(Object *obj, Visitor *v,
>       if (!value && s->pci_hole64_fix) {
>           value = pc_pci_hole64_start();
>       }
> -    visit_type_uint64(v, name, &value, errp);
> +    return value;
> +}
> +
> +static void i440fx_pcihost_get_pci_hole64_start(Object *obj, Visitor *v,
> +                                                const char *name,
> +                                                void *opaque, Error **errp)
> +{
> +    uint64_t hole64_start = i440fx_pcihost_get_pci_hole64_start_value(obj);
> +
> +    visit_type_uint64(v, name, &hole64_start, errp);
>   }
>   
>   /*
> diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
> index 02f95765880a..8acf942b5e65 100644
> --- a/hw/pci-host/q35.c
> +++ b/hw/pci-host/q35.c
> @@ -109,9 +109,7 @@ static void q35_host_get_pci_hole_end(Object *obj, Visitor *v,
>    * the 64bit PCI hole will start after "over 4G RAM" and the
>    * reserved space for memory hotplug if any.
>    */
> -static void q35_host_get_pci_hole64_start(Object *obj, Visitor *v,
> -                                          const char *name, void *opaque,
> -                                          Error **errp)
> +static uint64_t q35_host_get_pci_hole64_start_value(Object *obj)
>   {
>       PCIHostState *h = PCI_HOST_BRIDGE(obj);
>       Q35PCIHost *s = Q35_HOST_DEVICE(obj);
> @@ -123,7 +121,16 @@ static void q35_host_get_pci_hole64_start(Object *obj, Visitor *v,
>       if (!value && s->pci_hole64_fix) {
>           value = pc_pci_hole64_start();
>       }
> -    visit_type_uint64(v, name, &value, errp);
> +    return value;
> +}
> +
> +static void q35_host_get_pci_hole64_start(Object *obj, Visitor *v,
> +                                          const char *name, void *opaque,
> +                                          Error **errp)
> +{
> +    uint64_t hole64_start = q35_host_get_pci_hole64_start_value(obj);
> +
> +    visit_type_uint64(v, name, &hole64_start, errp);
>   }
>   
>   /*


Reviewed-by: Marcel Apfelbaum<marcel.apfelbaum@gmail.com>


Thanks,
Marcel
diff mbox series

Patch

diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 0e608347c1f0..0df91e002076 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -249,9 +249,7 @@  static void i440fx_pcihost_get_pci_hole_end(Object *obj, Visitor *v,
  * the 64bit PCI hole will start after "over 4G RAM" and the
  * reserved space for memory hotplug if any.
  */
-static void i440fx_pcihost_get_pci_hole64_start(Object *obj, Visitor *v,
-                                                const char *name,
-                                                void *opaque, Error **errp)
+static uint64_t i440fx_pcihost_get_pci_hole64_start_value(Object *obj)
 {
     PCIHostState *h = PCI_HOST_BRIDGE(obj);
     I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
@@ -263,7 +261,16 @@  static void i440fx_pcihost_get_pci_hole64_start(Object *obj, Visitor *v,
     if (!value && s->pci_hole64_fix) {
         value = pc_pci_hole64_start();
     }
-    visit_type_uint64(v, name, &value, errp);
+    return value;
+}
+
+static void i440fx_pcihost_get_pci_hole64_start(Object *obj, Visitor *v,
+                                                const char *name,
+                                                void *opaque, Error **errp)
+{
+    uint64_t hole64_start = i440fx_pcihost_get_pci_hole64_start_value(obj);
+
+    visit_type_uint64(v, name, &hole64_start, errp);
 }
 
 /*
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 02f95765880a..8acf942b5e65 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -109,9 +109,7 @@  static void q35_host_get_pci_hole_end(Object *obj, Visitor *v,
  * the 64bit PCI hole will start after "over 4G RAM" and the
  * reserved space for memory hotplug if any.
  */
-static void q35_host_get_pci_hole64_start(Object *obj, Visitor *v,
-                                          const char *name, void *opaque,
-                                          Error **errp)
+static uint64_t q35_host_get_pci_hole64_start_value(Object *obj)
 {
     PCIHostState *h = PCI_HOST_BRIDGE(obj);
     Q35PCIHost *s = Q35_HOST_DEVICE(obj);
@@ -123,7 +121,16 @@  static void q35_host_get_pci_hole64_start(Object *obj, Visitor *v,
     if (!value && s->pci_hole64_fix) {
         value = pc_pci_hole64_start();
     }
-    visit_type_uint64(v, name, &value, errp);
+    return value;
+}
+
+static void q35_host_get_pci_hole64_start(Object *obj, Visitor *v,
+                                          const char *name, void *opaque,
+                                          Error **errp)
+{
+    uint64_t hole64_start = q35_host_get_pci_hole64_start_value(obj);
+
+    visit_type_uint64(v, name, &hole64_start, errp);
 }
 
 /*