diff mbox series

[1/2] hw/arm/smmu-common: Fix the name of the iommu memory regions

Message ID 20180921070138.10114-2-eric.auger@redhat.com
State New
Headers show
Series [1/2] hw/arm/smmu-common: Fix the name of the iommu memory regions | expand

Commit Message

Eric Auger Sept. 21, 2018, 7:01 a.m. UTC
At the point smmu_find_add_as() gets called, the bus number might
not be computed. Let's change the name of IOMMU memory region and
just use the devfn and an incrementing index.

The name only is used for debug.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
 hw/arm/smmu-common.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Peter Maydell Sept. 25, 2018, 2:09 p.m. UTC | #1
On 21 September 2018 at 08:01, Eric Auger <eric.auger@redhat.com> wrote:
> At the point smmu_find_add_as() gets called, the bus number might
> not be computed. Let's change the name of IOMMU memory region and
> just use the devfn and an incrementing index.
>
> The name only is used for debug.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> ---
>  hw/arm/smmu-common.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
> index 55c75d65d2..3f55cfd193 100644
> --- a/hw/arm/smmu-common.c
> +++ b/hw/arm/smmu-common.c
> @@ -311,6 +311,7 @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)
>      SMMUState *s = opaque;
>      SMMUPciBus *sbus = g_hash_table_lookup(s->smmu_pcibus_by_busptr, bus);
>      SMMUDevice *sdev;
> +    static uint index;

"uint" isn't a standard type (and causes a build failure on
at least one of my build systems). Did you mean "unsigned int" ?

thanks
-- PMM
Eric Auger Sept. 25, 2018, 2:16 p.m. UTC | #2
Hi Peter,

On 9/25/18 4:09 PM, Peter Maydell wrote:
> On 21 September 2018 at 08:01, Eric Auger <eric.auger@redhat.com> wrote:
>> At the point smmu_find_add_as() gets called, the bus number might
>> not be computed. Let's change the name of IOMMU memory region and
>> just use the devfn and an incrementing index.
>>
>> The name only is used for debug.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>> ---
>>  hw/arm/smmu-common.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
>> index 55c75d65d2..3f55cfd193 100644
>> --- a/hw/arm/smmu-common.c
>> +++ b/hw/arm/smmu-common.c
>> @@ -311,6 +311,7 @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)
>>      SMMUState *s = opaque;
>>      SMMUPciBus *sbus = g_hash_table_lookup(s->smmu_pcibus_by_busptr, bus);
>>      SMMUDevice *sdev;
>> +    static uint index;
> 
> "uint" isn't a standard type (and causes a build failure on
> at least one of my build systems). Did you mean "unsigned int" ?
Hum yes, I did. Shall I repost or do you fix it directly?

Thanks

Eric
> 
> thanks
> -- PMM
>
Peter Maydell Sept. 25, 2018, 2:24 p.m. UTC | #3
On 25 September 2018 at 15:16, Auger Eric <eric.auger@redhat.com> wrote:
> Hi Peter,
>
> On 9/25/18 4:09 PM, Peter Maydell wrote:
>> On 21 September 2018 at 08:01, Eric Auger <eric.auger@redhat.com> wrote:
>>> At the point smmu_find_add_as() gets called, the bus number might
>>> not be computed. Let's change the name of IOMMU memory region and
>>> just use the devfn and an incrementing index.
>>>
>>> The name only is used for debug.
>>>
>>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>>> ---
>>>  hw/arm/smmu-common.c | 6 +++---
>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
>>> index 55c75d65d2..3f55cfd193 100644
>>> --- a/hw/arm/smmu-common.c
>>> +++ b/hw/arm/smmu-common.c
>>> @@ -311,6 +311,7 @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)
>>>      SMMUState *s = opaque;
>>>      SMMUPciBus *sbus = g_hash_table_lookup(s->smmu_pcibus_by_busptr, bus);
>>>      SMMUDevice *sdev;
>>> +    static uint index;
>>
>> "uint" isn't a standard type (and causes a build failure on
>> at least one of my build systems). Did you mean "unsigned int" ?
> Hum yes, I did. Shall I repost or do you fix it directly?

I've fixed it up in my v2 pull request.

thanks
-- PMM
Eric Auger Sept. 25, 2018, 2:26 p.m. UTC | #4
Hi Peter,

On 9/25/18 4:24 PM, Peter Maydell wrote:
> On 25 September 2018 at 15:16, Auger Eric <eric.auger@redhat.com> wrote:
>> Hi Peter,
>>
>> On 9/25/18 4:09 PM, Peter Maydell wrote:
>>> On 21 September 2018 at 08:01, Eric Auger <eric.auger@redhat.com> wrote:
>>>> At the point smmu_find_add_as() gets called, the bus number might
>>>> not be computed. Let's change the name of IOMMU memory region and
>>>> just use the devfn and an incrementing index.
>>>>
>>>> The name only is used for debug.
>>>>
>>>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>>>> ---
>>>>  hw/arm/smmu-common.c | 6 +++---
>>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
>>>> index 55c75d65d2..3f55cfd193 100644
>>>> --- a/hw/arm/smmu-common.c
>>>> +++ b/hw/arm/smmu-common.c
>>>> @@ -311,6 +311,7 @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)
>>>>      SMMUState *s = opaque;
>>>>      SMMUPciBus *sbus = g_hash_table_lookup(s->smmu_pcibus_by_busptr, bus);
>>>>      SMMUDevice *sdev;
>>>> +    static uint index;
>>>
>>> "uint" isn't a standard type (and causes a build failure on
>>> at least one of my build systems). Did you mean "unsigned int" ?
>> Hum yes, I did. Shall I repost or do you fix it directly?
> 
> I've fixed it up in my v2 pull request.

OK thanks!

Eric
> 
> thanks
> -- PMM
>
diff mbox series

Patch

diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
index 55c75d65d2..3f55cfd193 100644
--- a/hw/arm/smmu-common.c
+++ b/hw/arm/smmu-common.c
@@ -311,6 +311,7 @@  static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)
     SMMUState *s = opaque;
     SMMUPciBus *sbus = g_hash_table_lookup(s->smmu_pcibus_by_busptr, bus);
     SMMUDevice *sdev;
+    static uint index;
 
     if (!sbus) {
         sbus = g_malloc0(sizeof(SMMUPciBus) +
@@ -321,9 +322,8 @@  static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)
 
     sdev = sbus->pbdev[devfn];
     if (!sdev) {
-        char *name = g_strdup_printf("%s-%d-%d",
-                                     s->mrtypename,
-                                     pci_bus_num(bus), devfn);
+        char *name = g_strdup_printf("%s-%d-%d", s->mrtypename, devfn, index++);
+
         sdev = sbus->pbdev[devfn] = g_new0(SMMUDevice, 1);
 
         sdev->smmu = s;