[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c6e09d1e-c950-4ba7-8773-2062e0c62068@amd.com>
Date: Mon, 15 Sep 2025 17:43:33 +1000
From: Alexey Kardashevskiy <aik@....com>
To: Borislav Petkov <bp@...en8.de>
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
Bjorn Helgaas <bhelgaas@...gle.com>, David Woodhouse <dwmw@...zon.co.uk>,
Kai-Heng Feng <kai.heng.feng@...onical.com>,
Paolo Bonzini <pbonzini@...hat.com>, Sean Christopherson
<seanjc@...gle.com>, Santosh Shukla <santosh.shukla@....com>,
"Nikunj A. Dadhania" <nikunj@....com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
Subject: Re: [RFC PATCH] PCI: Add quirk to always map ivshmem as write-back
On 13/9/25 02:49, Borislav Petkov wrote:
> 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!
It is :)
> 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...
yeah, sadly, there is one - people are actually using it, for, like, a decade, and not exactly keen on changing those user space tools :) Hence "RFC".
>> 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.
Why? Compiles and works just fine.
--
Alexey
Powered by blists - more mailing lists