On Thu, Jun 12, 2025 at 06:22:33PM +1000, Alexey Kardashevskiy wrote: > QEMU Inter-VM Shared Memory (ivshmem) is designed to share a memory > region between guest and host. The host creates a file, passes it to QEMU > which it presents to the guest via PCI BAR#2. The guest userspace > can map /sys/bus/pci/devices/0000:01:02.3/resource2(_wc) to use the region > without having the guest driver for the device at all. > > The problem with this, since it is a PCI resource, the PCI sysfs > reasonably enforces: Ok, so I read it up until now and can't continue because all I hear is a big honking HACK alarm here! Shared memory which is presented to a guest via PCI BAR?!? Can it get any more ugly than this? I hope I'm missing an important aspect here... > diff --git a/drivers/pci/mmap.c b/drivers/pci/mmap.c > index 8da3347a95c4..8495bee08fae 100644 > --- a/drivers/pci/mmap.c > +++ b/drivers/pci/mmap.c > @@ -35,6 +35,7 @@ int pci_mmap_resource_range(struct pci_dev *pdev, int bar, > if (write_combine) > vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); > else > + else if (!(pci_resource_flags(pdev, bar) & IORESOURCE_CACHEABLE)) ^^^^^^ This can't build. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette