Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-09-27 Thread Michael S. Tsirkin
On Fri, Sep 24, 2021 at 03:43:40PM -0700, Andi Kleen wrote: > > > > Hmm, yes that's true. I guess we can make it default to opt-in for > > > pci_iomap. > > > > > > It only really matters for device less ioremaps. > > OK. And same thing for other things with device, such as > >

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-09-24 Thread Andi Kleen
Hmm, yes that's true. I guess we can make it default to opt-in for pci_iomap. It only really matters for device less ioremaps. OK. And same thing for other things with device, such as devm_platform_ioremap_resource. If we agree on all that, this will basically remove virtio changes from the

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-09-12 Thread Michael S. Tsirkin
On Sat, Sep 11, 2021 at 07:54:43PM -0400, Michael S. Tsirkin wrote: > On Fri, Sep 10, 2021 at 09:34:45AM -0700, Andi Kleen wrote: > > > > that's why > > > > an extra level of defense of ioremap opt-in is useful. > > > OK even assuming this, why is pci_iomap opt-in useful? > > > That never happens

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-09-11 Thread Michael S. Tsirkin
On Fri, Sep 10, 2021 at 09:34:45AM -0700, Andi Kleen wrote: > > > that's why > > > an extra level of defense of ioremap opt-in is useful. > > OK even assuming this, why is pci_iomap opt-in useful? > > That never happens before probe - there's simply no pci_device then. > > > Hmm, yes that's

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-09-10 Thread Andi Kleen
And we've been avoiding that drivers can self declare auditing, we've been trying to have a separate centralized list so that it's easier to enforce and avoids any cut'n'paste mistakes. -Andi Now I'm confused. What is proposed here seems to be basically that, drivers need to declare auditing

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-09-10 Thread Michael S. Tsirkin
On Mon, Aug 30, 2021 at 05:23:17PM -0700, Andi Kleen wrote: > > On 8/30/2021 1:59 PM, Michael S. Tsirkin wrote: > > > > > Or we can add _audited to the name. ioremap_shared_audited? > > But it's not the mapping that has to be done in handled special way. > > It's any data we get from device, not

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-30 Thread Andi Kleen
On 8/30/2021 1:59 PM, Michael S. Tsirkin wrote: Or we can add _audited to the name. ioremap_shared_audited? But it's not the mapping that has to be done in handled special way. It's any data we get from device, not all of it coming from IO, e.g. there's DMA and interrupts that all have to

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-30 Thread Michael S. Tsirkin
On Sun, Aug 29, 2021 at 10:11:46PM -0700, Andi Kleen wrote: > > On 8/29/2021 3:26 PM, Michael S. Tsirkin wrote: > > On Sun, Aug 29, 2021 at 09:17:53AM -0700, Andi Kleen wrote: > > > Also I changing this single call really that bad? It's not that we > > > changing > > > anything drastic here,

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-29 Thread Andi Kleen
On 8/29/2021 3:26 PM, Michael S. Tsirkin wrote: On Sun, Aug 29, 2021 at 09:17:53AM -0700, Andi Kleen wrote: Also I changing this single call really that bad? It's not that we changing anything drastic here, just give the low level subsystem a better hint about the intention. If you don't like

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-29 Thread Michael S. Tsirkin
On Sun, Aug 29, 2021 at 09:17:53AM -0700, Andi Kleen wrote: > Also I changing this single call really that bad? It's not that we changing > anything drastic here, just give the low level subsystem a better hint about > the intention. If you don't like the function name, could make it an > argument

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-29 Thread Andi Kleen
All this makes sense but ioremap is such a random place to declare driver has been audited, and it's baked into the binary with no way for userspace to set policy. Again all we will end up with is gradual replacement of all ioremap calls with ioremap_shared as people discover a given driver does

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-29 Thread Andi Kleen
Let's be frank, even without encryption disabling most drivers - especially weird ones that poke at hardware before probe - is far safer than keeping them, but one loses a bunch of features. Usually we don't lose features at all. None of the legacy drivers are needed on a guest (or even a

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-29 Thread Michael S. Tsirkin
On Tue, Aug 24, 2021 at 10:04:26AM -0700, Andi Kleen wrote: > > On 8/24/2021 12:07 AM, Christoph Hellwig wrote: > > On Mon, Aug 23, 2021 at 05:30:54PM -0700, Kuppuswamy, Sathyanarayanan wrote: > > > > > > On 8/23/21 4:56 PM, Michael S. Tsirkin wrote: > > > > > Add a new variant of pci_iomap for

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-29 Thread Michael S. Tsirkin
On Tue, Aug 24, 2021 at 10:20:44AM -0700, Andi Kleen wrote: > > > I see. Hmm. It's a bit of a random thing to do it at the map time > > though. E.g. DMA is all handled transparently behind the DMA API. > > Hardening is much more than just replacing map with map_shared > > and I suspect what you

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-25 Thread Bjorn Helgaas
On Tue, Aug 24, 2021 at 01:50:00PM -0700, Andi Kleen wrote: > > On 8/24/2021 1:31 PM, Bjorn Helgaas wrote: > > On Tue, Aug 24, 2021 at 01:14:02PM -0700, Andi Kleen wrote: > > > On 8/24/2021 11:55 AM, Bjorn Helgaas wrote: > > > > [+cc Rajat; I still don't know what "shared memory with a hypervisor

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-24 Thread Dan Williams
On Tue, Aug 24, 2021 at 2:57 PM Rajat Jain wrote: > > On Mon, Aug 23, 2021 at 6:06 PM Dan Williams wrote: > > > > On Mon, Aug 23, 2021 at 5:31 PM Kuppuswamy, Sathyanarayanan > > wrote: > > > > > > > > > > > > On 8/23/21 4:56 PM, Michael S. Tsirkin wrote: > > > >> Add a new variant of pci_iomap

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-24 Thread Dan Williams
On Tue, Aug 24, 2021 at 1:50 PM Andi Kleen wrote: > > > On 8/24/2021 1:31 PM, Bjorn Helgaas wrote: > > On Tue, Aug 24, 2021 at 01:14:02PM -0700, Andi Kleen wrote: > >> On 8/24/2021 11:55 AM, Bjorn Helgaas wrote: > >>> [+cc Rajat; I still don't know what "shared memory with a hypervisor > >>> in a

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-24 Thread Andi Kleen
On 8/24/2021 1:31 PM, Bjorn Helgaas wrote: On Tue, Aug 24, 2021 at 01:14:02PM -0700, Andi Kleen wrote: On 8/24/2021 11:55 AM, Bjorn Helgaas wrote: [+cc Rajat; I still don't know what "shared memory with a hypervisor in a confidential guest" means, A confidential guest is a guest which uses

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-24 Thread Bjorn Helgaas
On Tue, Aug 24, 2021 at 01:14:02PM -0700, Andi Kleen wrote: > > On 8/24/2021 11:55 AM, Bjorn Helgaas wrote: > > [+cc Rajat; I still don't know what "shared memory with a hypervisor > > in a confidential guest" means, > > A confidential guest is a guest which uses memory encryption to isolate >

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-24 Thread Andi Kleen
On 8/24/2021 11:55 AM, Bjorn Helgaas wrote: [+cc Rajat; I still don't know what "shared memory with a hypervisor in a confidential guest" means, A confidential guest is a guest which uses memory encryption to isolate itself from the host. It doesn't trust the host. But it still needs to

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-24 Thread Bjorn Helgaas
[+cc Rajat; I still don't know what "shared memory with a hypervisor in a confidential guest" means, but now we're talking about hardened drivers and allow lists, which Rajat is interested in] On Tue, Aug 24, 2021 at 10:20:44AM -0700, Andi Kleen wrote: > > > I see. Hmm. It's a bit of a random

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-24 Thread Andi Kleen
I see. Hmm. It's a bit of a random thing to do it at the map time though. E.g. DMA is all handled transparently behind the DMA API. Hardening is much more than just replacing map with map_shared and I suspect what you will end up with is basically vendors replacing map with map shared to make

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-24 Thread Andi Kleen
On 8/24/2021 12:07 AM, Christoph Hellwig wrote: On Mon, Aug 23, 2021 at 05:30:54PM -0700, Kuppuswamy, Sathyanarayanan wrote: On 8/23/21 4:56 PM, Michael S. Tsirkin wrote: Add a new variant of pci_iomap for mapping all PCI resources of a devices as shared memory with a hypervisor in a

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-24 Thread Michael S. Tsirkin
On Mon, Aug 23, 2021 at 07:14:18PM -0700, Andi Kleen wrote: > > On 8/23/2021 6:04 PM, Dan Williams wrote: > > On Mon, Aug 23, 2021 at 5:31 PM Kuppuswamy, Sathyanarayanan > > wrote: > > > > > > > > > On 8/23/21 4:56 PM, Michael S. Tsirkin wrote: > > > > > Add a new variant of pci_iomap for

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-24 Thread Michael S. Tsirkin
On Mon, Aug 23, 2021 at 05:30:54PM -0700, Kuppuswamy, Sathyanarayanan wrote: > > > On 8/23/21 4:56 PM, Michael S. Tsirkin wrote: > > > Add a new variant of pci_iomap for mapping all PCI resources > > > of a devices as shared memory with a hypervisor in a confidential > > > guest. > > > > > >

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-24 Thread Christoph Hellwig
On Mon, Aug 23, 2021 at 05:30:54PM -0700, Kuppuswamy, Sathyanarayanan wrote: > > > On 8/23/21 4:56 PM, Michael S. Tsirkin wrote: > > > Add a new variant of pci_iomap for mapping all PCI resources > > > of a devices as shared memory with a hypervisor in a confidential > > > guest. > > > > > >

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-23 Thread Andi Kleen
On 8/23/2021 6:04 PM, Dan Williams wrote: On Mon, Aug 23, 2021 at 5:31 PM Kuppuswamy, Sathyanarayanan wrote: On 8/23/21 4:56 PM, Michael S. Tsirkin wrote: Add a new variant of pci_iomap for mapping all PCI resources of a devices as shared memory with a hypervisor in a confidential guest.

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-23 Thread Dan Williams
On Mon, Aug 23, 2021 at 5:31 PM Kuppuswamy, Sathyanarayanan wrote: > > > > On 8/23/21 4:56 PM, Michael S. Tsirkin wrote: > >> Add a new variant of pci_iomap for mapping all PCI resources > >> of a devices as shared memory with a hypervisor in a confidential > >> guest. > >> > >> Signed-off-by:

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-23 Thread Michael S. Tsirkin
On Wed, Aug 04, 2021 at 05:52:14PM -0700, Kuppuswamy Sathyanarayanan wrote: > From: Andi Kleen > > Add a new variant of pci_iomap for mapping all PCI resources > of a devices as shared memory with a hypervisor in a confidential > guest. > > Signed-off-by: Andi Kleen > Signed-off-by: Kuppuswamy

Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range}

2021-08-13 Thread Christoph Hellwig
On Wed, Aug 04, 2021 at 05:52:14PM -0700, Kuppuswamy Sathyanarayanan wrote: > +extern void __iomem *pci_iomap_shared(struct pci_dev *dev, int bar, > + unsigned long max); > +extern void __iomem *pci_iomap_shared_range(struct pci_dev *dev, int bar, > +