All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Ani Sinha <ani.sinha@nutanix.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Laine Stump <laine@redhat.com>
Subject: Re: Hot unplug disabling on pci-pci bridge
Date: Tue, 24 Mar 2020 12:08:28 +0100	[thread overview]
Message-ID: <20200324120828.2b50d41e@redhat.com> (raw)
In-Reply-To: <BF9E6F48-E047-4D1B-BEF1-A58024DE0C6E@nutanix.com>

On Tue, 24 Mar 2020 10:06:00 +0000
Ani Sinha <ani.sinha@nutanix.com> wrote:

> Hi All :
> 
> I have been playing with Qemu trying to disable hot-unplug capability for conventional PCI. I have discussed this briefly on IRC and the plan is to have an option on the pci-pci bridge that would disable SHPC and ACPI hotplug capability for all the slots on that bus. I am _not_ trying to implement a per slot capability for conventional PCI as was previously posted for PCIE slots in this patch : https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg01833.html (we do not need this atm).
> 
> I am following the conversations which happened few weeks back here:
> 
> https://lists.gnu.org/archive/html/qemu-devel/2020-02/msg00985.html

question is do you need to disable only unplug side both
(plug+unplug) operations (like we did with PCIE)?

> 
> To that end, I have been experimenting with Qemu using the patch I attach below. I have attached the virtio balloon driver with bus 1 which is attached to the pci bridge. Following is the libvirt 4.5 xml snippet which I am using:
> 
>    <controller type='pci' index='0' model='pci-root'>
>       <alias name='pci.0'/>
>    </controller>
>   <controller type='pci' index='1' model='pci-bridge'>
>       <model name='pci-bridge'/>
>       <target chassisNr='1'/>
>       <alias name='pci.1'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
>    </controller>
>   <memballoon model='virtio'>
>       <stats period='30'/>
>       <alias name='balloon0'/>
>       <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
>    </memballoon>
> 
> 
> I am using a windows guest and from the guest I can see that the balloon driver is indeed attached to the pci bridge (see attached screenshot).
> I still find Windows giving me an option to hot eject the pci balloon driver.
> 
> So what am I doing wrong here?
> 
> [cid:F2407B5B-BBB1-4A0C-91C4-975692E3BDE1]
> 
> 
> 
> The Qemu patch I am experimenting with (which is currently a hack) is attached below. It is based off Qemu 2.12 and not the latest mainline.
> 
> ---
> hw/pci-bridge/pci_bridge_dev.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
> index b2d861d..e706d49 100644
> --- a/hw/pci-bridge/pci_bridge_dev.c
> +++ b/hw/pci-bridge/pci_bridge_dev.c
> @@ -58,7 +58,7 @@ static void pci_bridge_dev_realize(PCIDevice *dev, Error **errp)
> 
>     pci_bridge_initfn(dev, TYPE_PCI_BUS);
> 
> -    if (bridge_dev->flags & (1 << PCI_BRIDGE_DEV_F_SHPC_REQ)) {
> +    if (0) {//bridge_dev->flags & (1 << PCI_BRIDGE_DEV_F_SHPC_REQ)) {
>         dev->config[PCI_INTERRUPT_PIN] = 0x1;
>         memory_region_init(&bridge_dev->bar, OBJECT(dev), "shpc-bar",
>                            shpc_bar_size(dev));
> @@ -161,7 +161,7 @@ static Property pci_bridge_dev_properties[] = {
>     DEFINE_PROP_ON_OFF_AUTO(PCI_BRIDGE_DEV_PROP_MSI, PCIBridgeDev, msi,
>                             ON_OFF_AUTO_AUTO),
>     DEFINE_PROP_BIT(PCI_BRIDGE_DEV_PROP_SHPC, PCIBridgeDev, flags,
> -                    PCI_BRIDGE_DEV_F_SHPC_REQ, true),
> +                    PCI_BRIDGE_DEV_F_SHPC_REQ, false),
>     DEFINE_PROP_END_OF_LIST(),
> };
> 
> @@ -181,7 +181,7 @@ static const VMStateDescription pci_bridge_dev_vmstate = {
>         VMSTATE_END_OF_LIST()
>     }
> };
> -
> +#if 0
> static void pci_bridge_dev_hotplug_cb(HotplugHandler *hotplug_dev,
>                                       DeviceState *dev, Error **errp)
> {
> @@ -208,12 +208,12 @@ static void pci_bridge_dev_hot_unplug_request_cb(HotplugHandler *hotplug_dev,
>     }
>     shpc_device_hot_unplug_request_cb(hotplug_dev, dev, errp);
> }
> -
> +#endif
> static void pci_bridge_dev_class_init(ObjectClass *klass, void *data)
> {
>     DeviceClass *dc = DEVICE_CLASS(klass);
>     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
> -    HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
> +    //HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
> 
>     k->realize = pci_bridge_dev_realize;
>     k->exit = pci_bridge_dev_exitfn;
> @@ -227,8 +227,8 @@ static void pci_bridge_dev_class_init(ObjectClass *klass, void *data)
>     dc->props = pci_bridge_dev_properties;
>     dc->vmsd = &pci_bridge_dev_vmstate;
>     set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
> -    hc->plug = pci_bridge_dev_hotplug_cb;
> -    hc->unplug_request = pci_bridge_dev_hot_unplug_request_cb;
> +    //hc->plug = pci_bridge_dev_hotplug_cb;
> +    //hc->unplug_request = pci_bridge_dev_hot_unplug_request_cb;
> }
> 
> static const TypeInfo pci_bridge_dev_info = {
> @@ -238,7 +238,7 @@ static const TypeInfo pci_bridge_dev_info = {
>     .class_init        = pci_bridge_dev_class_init,
>     .instance_finalize = pci_bridge_dev_instance_finalize,
>     .interfaces = (InterfaceInfo[]) {
> -        { TYPE_HOTPLUG_HANDLER },
> +        //{ TYPE_HOTPLUG_HANDLER },
>         { INTERFACE_CONVENTIONAL_PCI_DEVICE },
>         { }
>     }
> --
> 1.9.4
> 



  reply	other threads:[~2020-03-24 11:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24 10:06 Hot unplug disabling on pci-pci bridge Ani Sinha
2020-03-24 11:08 ` Igor Mammedov [this message]
2020-03-24 11:49   ` Ani Sinha
2020-03-24 14:09     ` Igor Mammedov
2020-03-24 16:07       ` Ani Sinha
2020-03-24 11:17 ` Igor Mammedov
2020-03-24 13:29   ` Ani Sinha
2020-03-24 14:17     ` Igor Mammedov
2020-03-24 15:27       ` Ani Sinha
2020-04-17 15:33       ` Ani Sinha

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=20200324120828.2b50d41e@redhat.com \
    --to=imammedo@redhat.com \
    --cc=ani.sinha@nutanix.com \
    --cc=laine@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.