qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel@redhat.com>
To: Alexander Bezzubikov <zuban32s@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org, Igor Mammedov <imammedo@redhat.com>,
	pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com,
	Gerd Hoffmann <kraxel@redhat.com>,
	seabios@seabios.org
Subject: Re: [Qemu-devel] [RFC PATCH v2 5/6] hw/pci: add bus_reserve property to pcie-root-port
Date: Tue, 25 Jul 2017 19:10:33 +0300	[thread overview]
Message-ID: <a16dcefb-8abd-cf24-762c-82e26a0f9ec4@redhat.com> (raw)
In-Reply-To: <CAKSfGUDiJ9GVNepiX7nGHtPf5=OqUaZgyPwwwDUDWuwnAND-Ew@mail.gmail.com>

On 25/07/2017 17:09, Alexander Bezzubikov wrote:
> 2017-07-25 16:53 GMT+03:00 Michael S. Tsirkin <mst@redhat.com>:
>> On Tue, Jul 25, 2017 at 04:50:49PM +0300, Alexander Bezzubikov wrote:
>>> 2017-07-25 16:43 GMT+03:00 Michael S. Tsirkin <mst@redhat.com>:
>>>> On Sun, Jul 23, 2017 at 05:13:11PM +0300, Marcel Apfelbaum wrote:
>>>>> On 23/07/2017 15:22, Michael S. Tsirkin wrote:
>>>>>> On Sun, Jul 23, 2017 at 01:15:42AM +0300, Aleksandr Bezzubikov wrote:
>>>>>>> To enable hotplugging of a newly created pcie-pci-bridge,
>>>>>>> we need to tell firmware (SeaBIOS in this case)
>>>>>>
>>>>>
>>>>> Hi Michael,
>>>>>
>>>>>> Presumably, EFI would need to support this too?
>>>>>>
>>>>>
>>>>> Sure, Eduardo added to CC, but he is in PTO now.
>>>>>
>>>>>>> to reserve
>>>>>>> additional buses for pcie-root-port, that allows us to
>>>>>>> hotplug pcie-pci-bridge into this root port.
>>>>>>> The number of buses to reserve is provided to the device via a corresponding
>>>>>>> property, and to the firmware via new PCI capability (next patch).
>>>>>>> The property's default value is 1 as we want to hotplug at least 1 bridge.
>>>>>>
>>>>>> If so you should just teach firmware to allocate one bus #
>>>>>> unconditionally.
>>>>>>
>>>>>
>>>>> That would be a problem for the PCIe machines, since each PCIe
>>>>> devices is plugged in a different bus and we are already
>>>>> limited to 256 PCIe devices. Allocating an extra-bus always
>>>>> would really limit the PCIe devices we can use.
>>>>
>>>> One of the declared advantages of PCIe is easy support for multiple roots.
>>>> We really should look at that IMHO so we do not need to pile up hacks.
>>>>
>>>>>> But why would that be so? What's wrong with a device
>>>>>> directly in the root port?
>>>>>>
>>>>
>>>> To clarify, my point is we might be wasting bus numbers by reservation
>>>> since someone might just want to put pcie devices there.
>>>
>>> I think, changing default value to 0 can help us avoid this,
>>> as no bus reservation by default. If one's surely wants
>>> to hotplug pcie-pci-bridge into this root port in future,
>>> the property gives him such an opportunity.
>>> So, sure need pcie-pci-bridge hotplug -> creating a root port with
>>> bus_reserve > 0. Otherwise (and default) - just as now, no changes
>>> in bus topology.
>>
>> I guess 0 should mean "do not reserve any buses".  So I think we also
>> need a flag to just avoid the capability altogether.  Maybe -1?  *That*
>> should be the default.
> 
> -1 might be useful if any limit value 0 is legal, but is it?
> If not, we can set every field to 0 and
> this is a sign of avoiding capability since none legal
> values are provided.
> 

As Gerd suggested, this value is not a "delta" but the number
of buses to be reserved behind the bridge. If I got it right,
0 is not a valid value, since the bridge by definition
has a list one bus behind.

Michael, would you be OK with that?

Thanks,
Marcel

>>
>>>>
>>>>> First, plugging a legacy PCI device into a PCIe Root Port
>>>>> looks strange at least, and it can;t be done on real HW anyway.
>>>>> (incompatible slots)
>>>>>
>>>>> Second (and more important), if we want 2 or more PCI
>>>>> devices we would loose both IO ports space and bus numbers.
>>>>>
>>>>>>
>>>>>>>
>>>>>>> Signed-off-by: Aleksandr Bezzubikov <zuban32s@gmail.com>
>>>>>>> ---
>>>>>>>    hw/pci-bridge/pcie_root_port.c | 1 +
>>>>>>>    include/hw/pci/pcie_port.h     | 3 +++
>>>>>>>    2 files changed, 4 insertions(+)
>>>>>>>
>>>>>>> diff --git a/hw/pci-bridge/pcie_root_port.c b/hw/pci-bridge/pcie_root_port.c
>>>>>>> index 4d588cb..b0e49e1 100644
>>>>>>> --- a/hw/pci-bridge/pcie_root_port.c
>>>>>>> +++ b/hw/pci-bridge/pcie_root_port.c
>>>>>>> @@ -137,6 +137,7 @@ static void rp_exit(PCIDevice *d)
>>>>>>>    static Property rp_props[] = {
>>>>>>>        DEFINE_PROP_BIT(COMPAT_PROP_PCP, PCIDevice, cap_present,
>>>>>>>                        QEMU_PCIE_SLTCAP_PCP_BITNR, true),
>>>>>>> +    DEFINE_PROP_UINT8("bus_reserve", PCIEPort, bus_reserve, 1),
>>>>>>>        DEFINE_PROP_END_OF_LIST()
>>>>>>>    };
>>>>>>> diff --git a/include/hw/pci/pcie_port.h b/include/hw/pci/pcie_port.h
>>>>>>> index 1333266..1b2dd1f 100644
>>>>>>> --- a/include/hw/pci/pcie_port.h
>>>>>>> +++ b/include/hw/pci/pcie_port.h
>>>>>>> @@ -34,6 +34,9 @@ struct PCIEPort {
>>>>>>>        /* pci express switch port */
>>>>>>>        uint8_t     port;
>>>>>>> +
>>>>>>> +    /* additional buses to reserve on firmware init */
>>>>>>> +    uint8_t     bus_reserve;
>>>>>>>    };
>>>>>>>    void pcie_port_init_reg(PCIDevice *d);
>>>>>>
>>>>>> So here is a property and it does not do anything.
>>>>>> It makes it easier to work on series maybe, but review
>>>>>> is harder since we do not see what it does at all.
>>>>>> Please do not split up patches like this - you can maintain
>>>>>> it split up in your branch if you like and merge before sending.
>>>>>>
>>>>>
>>>>> Agreed, Alexandr please merge patches 4-5-6 for your next submission.
>>>>>
>>>>> Thanks,
>>>>> Marcel
>>>>>
>>>>>
>>>>>>> --
>>>>>>> 2.7.4
>>>
>>>
>>>
>>> --
>>> Alexander Bezzubikov
> 
> 
> 

  reply	other threads:[~2017-07-25 16:10 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-22 22:15 [Qemu-devel] [RFC PATCH v2 0/6] Generic PCIE-PCI Bridge Aleksandr Bezzubikov
2017-07-22 22:15 ` [Qemu-devel] [RFC PATCH v2 1/6] hw/pci: introduce pcie-pci-bridge device Aleksandr Bezzubikov
2017-07-22 22:15 ` [Qemu-devel] [RFC PATCH v2 2/6] hw/i386: allow SHPC for Q35 machine Aleksandr Bezzubikov
2017-07-23 15:59   ` Marcel Apfelbaum
2017-07-23 16:49     ` Alexander Bezzubikov
2017-07-22 22:15 ` [Qemu-devel] [RFC PATCH v2 3/6] hw/pci: enable SHPC for PCIE-PCI bridge Aleksandr Bezzubikov
2017-07-22 22:15 ` [Qemu-devel] [RFC PATCH v2 4/6] hw/pci: introduce bridge-only vendor-specific capability to provide some hints to firmware Aleksandr Bezzubikov
2017-07-23 15:57   ` Marcel Apfelbaum
2017-07-23 16:19     ` Alexander Bezzubikov
2017-07-23 16:24       ` Marcel Apfelbaum
2017-07-26 19:43   ` Michael S. Tsirkin
2017-07-26 21:54     ` Alexander Bezzubikov
2017-07-26 23:11       ` [Qemu-devel] [SeaBIOS] " Laszlo Ersek
2017-07-26 23:28       ` [Qemu-devel] " Michael S. Tsirkin
2017-07-27  9:39         ` Marcel Apfelbaum
2017-07-27 13:58           ` [Qemu-devel] [SeaBIOS] " Laszlo Ersek
2017-07-28 23:15             ` Michael S. Tsirkin
2017-07-31 18:16               ` Laszlo Ersek
2017-07-31 18:55                 ` Michael S. Tsirkin
2017-07-31 19:04                   ` Laszlo Ersek
2017-07-28 23:12           ` [Qemu-devel] " Michael S. Tsirkin
2017-07-31 10:06             ` Marcel Apfelbaum
2017-07-31 18:36               ` Michael S. Tsirkin
2017-07-22 22:15 ` [Qemu-devel] [RFC PATCH v2 5/6] hw/pci: add bus_reserve property to pcie-root-port Aleksandr Bezzubikov
2017-07-23 12:22   ` Michael S. Tsirkin
2017-07-23 14:13     ` Marcel Apfelbaum
2017-07-24 20:46       ` Michael S. Tsirkin
2017-07-24 21:41         ` Alexander Bezzubikov
2017-07-24 21:58           ` Michael S. Tsirkin
2017-07-25 11:49             ` Marcel Apfelbaum
2017-07-28 23:24               ` Michael S. Tsirkin
2017-07-25 13:43       ` Michael S. Tsirkin
2017-07-25 13:50         ` Alexander Bezzubikov
2017-07-25 13:53           ` Michael S. Tsirkin
2017-07-25 14:09             ` Alexander Bezzubikov
2017-07-25 16:10               ` Marcel Apfelbaum [this message]
2017-07-25 17:11                 ` Alexander Bezzubikov
2017-07-26  4:24                   ` Marcel Apfelbaum
2017-07-26  5:29                     ` Gerd Hoffmann
2017-07-28 23:26                 ` Michael S. Tsirkin
2017-07-22 22:15 ` [Qemu-devel] [RFC PATCH v2 6/6] hw/pci: add hint capabilty for additional bus reservation " Aleksandr Bezzubikov
2017-07-24 20:43   ` Michael S. Tsirkin
2017-07-24 21:43     ` Alexander Bezzubikov
2017-07-25 11:52       ` Marcel Apfelbaum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a16dcefb-8abd-cf24-762c-82e26a0f9ec4@redhat.com \
    --to=marcel@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=seabios@seabios.org \
    --cc=zuban32s@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).