diff mbox

[RFC,13/56] pci: Make PCI addresses and sizes unsigned in QAPI/QMP

Message ID 1502117160-24655-14-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster Aug. 7, 2017, 2:45 p.m. UTC
Sizes and addresses should use QAPI type 'size' (uint64_t).
PciMemoryRegion members @address and @size are 'int' (int64_t).
qmp_query_pci_regions() implicitly converts from pcibus_t,
i.e. uint64_t.

Change these PciMemoryRegion members to 'size'.

query-pci now reports sizes and addresses above 2^63-1 correctly
instead of their (negative) two's complement.

HMP's "info pci" already reported them correctly, because it
implicitly converted back to uint64_t.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 qapi-schema.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marcel Apfelbaum Aug. 22, 2017, 2:03 p.m. UTC | #1
Hi Markus,

On 07/08/2017 17:45, Markus Armbruster wrote:
> Sizes and addresses should use QAPI type 'size' (uint64_t).
> PciMemoryRegion members @address and @size are 'int' (int64_t).
> qmp_query_pci_regions() implicitly converts from pcibus_t,
> i.e. uint64_t.
> 
> Change these PciMemoryRegion members to 'size'.
> 
> query-pci now reports sizes and addresses above 2^63-1 correctly
> instead of their (negative) two's complement.
> 
> HMP's "info pci" already reported them correctly, because it
> implicitly converted back to uint64_t.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>   qapi-schema.json | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 6aa6be9..c8cceb9 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -2062,7 +2062,7 @@
>   # Since: 0.14.0
>   ##
>   { 'struct': 'PciMemoryRegion',
> -  'data': {'bar': 'int', 'type': 'str', 'address': 'int', 'size': 'int',
> +  'data': {'bar': 'int', 'type': 'str', 'address': 'size', 'size': 'size',
>              '*prefetch': 'bool', '*mem_type_64': 'bool' } }
>   
>   ##
> 

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

Thanks,
Marcel
diff mbox

Patch

diff --git a/qapi-schema.json b/qapi-schema.json
index 6aa6be9..c8cceb9 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2062,7 +2062,7 @@ 
 # Since: 0.14.0
 ##
 { 'struct': 'PciMemoryRegion',
-  'data': {'bar': 'int', 'type': 'str', 'address': 'int', 'size': 'int',
+  'data': {'bar': 'int', 'type': 'str', 'address': 'size', 'size': 'size',
            '*prefetch': 'bool', '*mem_type_64': 'bool' } }
 
 ##