diff mbox

[2/3] pci: add dev_reserved_mask property to PCIBus

Message ID 1499413442-5053-3-git-send-email-mark.cave-ayland@ilande.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Mark Cave-Ayland July 7, 2017, 7:44 a.m. UTC
This is just a simple bitmask indicating whether or not each PCI slot on the
bus is reserved. Ensure that it is initialised to zero so that all bus slots
are available by default.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/pci/pci.c             |    1 +
 include/hw/pci/pci_bus.h |    1 +
 2 files changed, 2 insertions(+)

Comments

Marcel Apfelbaum July 10, 2017, 7:27 a.m. UTC | #1
On 07/07/2017 10:44, Mark Cave-Ayland wrote:
> This is just a simple bitmask indicating whether or not each PCI slot on the
> bus is reserved. Ensure that it is initialised to zero so that all bus slots
> are available by default.
> 

Hi Mark,

> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>   hw/pci/pci.c             |    1 +
>   include/hw/pci/pci_bus.h |    1 +
>   2 files changed, 2 insertions(+)
> 
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 04e6edb..239161e 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -371,6 +371,7 @@ static void pci_bus_init(PCIBus *bus, DeviceState *parent,
>   {
>       assert(PCI_FUNC(devfn_min) == 0);
>       bus->devfn_min = devfn_min;
> +    bus->dev_reserved_mask = 0x0;

Not really necessary, the object are zeroed when created
(as far as I remember).

>       bus->address_space_mem = address_space_mem;
>       bus->address_space_io = address_space_io;
>   
> diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h
> index 5484a9b..a0cf655 100644
> --- a/include/hw/pci/pci_bus.h
> +++ b/include/hw/pci/pci_bus.h
> @@ -23,6 +23,7 @@ struct PCIBus {
>       PCIIOMMUFunc iommu_fn;
>       void *iommu_opaque;
>       uint8_t devfn_min;
> +    uint32_t dev_reserved_mask;

I would merge this patch with the next one to
see the new field "in action".

Thanks,
Marcel

>       pci_set_irq_fn set_irq;
>       pci_map_irq_fn map_irq;
>       pci_route_irq_fn route_intx_to_irq;
>
Mark Cave-Ayland July 10, 2017, 12:49 p.m. UTC | #2
On 10/07/17 08:27, Marcel Apfelbaum wrote:

> On 07/07/2017 10:44, Mark Cave-Ayland wrote:
>> This is just a simple bitmask indicating whether or not each PCI slot
>> on the
>> bus is reserved. Ensure that it is initialised to zero so that all bus
>> slots
>> are available by default.
>>
> 
> Hi Mark,
> 
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>>   hw/pci/pci.c             |    1 +
>>   include/hw/pci/pci_bus.h |    1 +
>>   2 files changed, 2 insertions(+)
>>
>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>> index 04e6edb..239161e 100644
>> --- a/hw/pci/pci.c
>> +++ b/hw/pci/pci.c
>> @@ -371,6 +371,7 @@ static void pci_bus_init(PCIBus *bus, DeviceState
>> *parent,
>>   {
>>       assert(PCI_FUNC(devfn_min) == 0);
>>       bus->devfn_min = devfn_min;
>> +    bus->dev_reserved_mask = 0x0;
> 
> Not really necessary, the object are zeroed when created
> (as far as I remember).

Yes I believe that's true. The main reason I added it was that it makes
it easy to find the default value with grep rather than having to work
your way through the initialisation sequence to verify that in fact it
belongs to a struct that is zeroed before use. So again, not 100%
necessary but I felt it made life a bit easier.

>>       bus->address_space_mem = address_space_mem;
>>       bus->address_space_io = address_space_io;
>>   diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h
>> index 5484a9b..a0cf655 100644
>> --- a/include/hw/pci/pci_bus.h
>> +++ b/include/hw/pci/pci_bus.h
>> @@ -23,6 +23,7 @@ struct PCIBus {
>>       PCIIOMMUFunc iommu_fn;
>>       void *iommu_opaque;
>>       uint8_t devfn_min;
>> +    uint32_t dev_reserved_mask;
> 
> I would merge this patch with the next one to
> see the new field "in action".

If everyone wants me to drop the above setting of dev_reserved_mask than
I can squash it into the following patch.


ATB,

Mark.
diff mbox

Patch

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 04e6edb..239161e 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -371,6 +371,7 @@  static void pci_bus_init(PCIBus *bus, DeviceState *parent,
 {
     assert(PCI_FUNC(devfn_min) == 0);
     bus->devfn_min = devfn_min;
+    bus->dev_reserved_mask = 0x0;
     bus->address_space_mem = address_space_mem;
     bus->address_space_io = address_space_io;
 
diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h
index 5484a9b..a0cf655 100644
--- a/include/hw/pci/pci_bus.h
+++ b/include/hw/pci/pci_bus.h
@@ -23,6 +23,7 @@  struct PCIBus {
     PCIIOMMUFunc iommu_fn;
     void *iommu_opaque;
     uint8_t devfn_min;
+    uint32_t dev_reserved_mask;
     pci_set_irq_fn set_irq;
     pci_map_irq_fn map_irq;
     pci_route_irq_fn route_intx_to_irq;