> On Apr 18, 2020, at 6:18 PM, Marcel Apfelbaum <marcel.apfelb...@gmail.com> > wrote: > > Hi Ani, > > On 4/18/20 6:25 AM, Ani Sinha wrote: >> +Julia who implemented >> https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.kernel.org_patch_11388881_&d=DwICaQ&c=s883GpUCOChKOHiocYtGcg&r=IIUxIyRwG4RGy57y2nvMNYcDkqW-NHozZ2R38VYcg5U&m=cpjHoQeyltZfRWa7a5aUuxM_5-x6_YZZCGb4UixhviE&s=bEc8FsThqIa9W1pzyh3VuOCICwTWwZikECD19MOmttg&e= >> >> >>> On Apr 18, 2020, at 3:26 AM, Laine Stump <la...@redhat.com> wrote: >>> >>> On 4/17/20 12:35 PM, Ani Sinha wrote: >>>> +Laine >>>>> On Apr 17, 2020, at 9:39 PM, Michael S. Tsirkin <m...@redhat.com> wrote: >>>>> >>>>> Problem is, I think this is not something we can support with pcie or >>>>> shpc. >>>>> I'm reluctant to add features that only ACPI can support, >>>>> we are trying to phase that out. >>>> Hmm. I see. We use conventional PCI and hence was looking for providing >>>> this feature for conventional PCI only. Laine might be able to throw some >>>> lights as to feasibility of the in PCIE world. >>> Sorry, my knowledge doesn't go that low. If there's a qemu option I can >>> expose it in libvirt, but am by no means an expert of qemu internals or the >>> pci/pcie specs :-) >>> >>> (BTW, I think in the past people have prevented enabling hot-unplug by >>> unprivileged users in Windows with some sort of a "system policy" in >>> Windows. (whatever that is - I don't use Windows, and have just heard this >>> from others when discussing the problem). >>> > > A PCIe Root Port or a PCI slot can or cannot support hot-plugging. Anything > in the middle can't be done at PCIe/PCI level (as far as I know). > I think the answer can be at the modelling level. Use non hot-pluggable slots > (or PCIe Root Ports without hot-plug support) for the devices > you don't want hot-unplugged, leave an empty PCI Bridge (or some PCIe Root > Ports with hot-plug support) to be able to hot-plug devices.
Yes, this is exactly the modeling I was going with to prevent users from within Windows guests to hot-unplug a device. Then I realized that if we plug in a device into a slot where hot plugging is disabled with an intention to disable hot unplugging, we can’t even hot plug a device into that slot. When we plug in a device into a slot where hot plugging is enabled, both plugging in and unplugging is possible. In other words, the behavior is symmetric in terms of both plugging and unplugging. Hence for conventional PCI I cooked up this patch where I disable “_EJ0” ACPI functions from pci-pci bridge to order to enable hot plugging but prevent hot unplugging into the slots of that bridge. I tested this on Windows guests and it seems to work. So my next question is, for PCIE, is there something equivalent that can be done? My knowledge is limited in that space. thanks ani