Re: swiotlb/virtio: unchecked device dma address and length

2020-12-17 Thread Ashish Kalra
On Wed, Dec 16, 2020 at 10:07:31PM +, Radev, Martin wrote: > Hello everybody, > > I will try help clarify some things. > > > On a DMA unmap SWIOTLB (when force is used) it trusts the driver from > > providing > > the correct DMA address and length which SWIOTLB uses to match to its > >

Re: swiotlb/virtio: unchecked device dma address and length

2020-12-17 Thread Ashish Kalra
On Thu, Dec 17, 2020 at 12:19:16PM +0800, Jason Wang wrote: > > On 2020/12/16 下午9:04, Konrad Rzeszutek Wilk wrote: > > On December 16, 2020 1:41:48 AM EST, Jason Wang wrote: > > > > > > - Original Message - > > > > > > > > - Original Message - > > > > > .snip. > > > > > > > >

Re: swiotlb/virtio: unchecked device dma address and length

2020-12-15 Thread Ashish Kalra
On Mon, Dec 14, 2020 at 04:49:50PM -0500, Konrad Rzeszutek Wilk wrote: > On Fri, Dec 11, 2020 at 06:31:21PM +0100, Felicitas Hetzelt wrote: > > Hello, > > Hi! Please see below my responses. > > > we have been analyzing the Hypervisor-OS interface of Linux > > and discovered bugs in the

[PATCH v9] x86, swiotlb: Adjust SWIOTLB bounce buffer size for SEV guests

2020-12-09 Thread Ashish Kalra
From: Ashish Kalra For SEV, all DMA to and from guest has to use shared (un-encrypted) pages. SEV uses SWIOTLB to make this happen without requiring changes to device drivers. However, depending on the workload being run, the default 64MB of it might not be enough and it may run out of buffers

Re: [PATCH v8] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-12-09 Thread Ashish Kalra
On Wed, Dec 09, 2020 at 06:51:05PM +0100, Borislav Petkov wrote: > On Wed, Dec 09, 2020 at 01:19:46PM +0000, Ashish Kalra wrote: > > reserve_crashkernel() calls swiotlb_size_or_default() to get SWIOTLB > ... > > Thanks for explaining. > > > There is a need to introdu

Re: [PATCH v8] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-12-09 Thread Ashish Kalra
On Wed, Dec 09, 2020 at 01:54:42PM +0100, Borislav Petkov wrote: > On Wed, Dec 09, 2020 at 12:29:07PM +0000, Ashish Kalra wrote: > > As i mentioned in the main comments above, this cannot be called in > > mem_encrypt_init() as that breaks reserve_crashkernel() which depends > &

Re: [PATCH v8] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-12-09 Thread Ashish Kalra
nd. > > On Mon, Dec 07, 2020 at 11:10:57PM +0000, Ashish Kalra wrote: > > From: Ashish Kalra > > > > For SEV, all DMA to and from guest has to use shared (un-encrypted) pages. > > SEV uses SWIOTLB to make this happen without requiring changes to device > > dri

[PATCH v8] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-12-07 Thread Ashish Kalra
From: Ashish Kalra For SEV, all DMA to and from guest has to use shared (un-encrypted) pages. SEV uses SWIOTLB to make this happen without requiring changes to device drivers. However, depending on workload being run, the default 64MB of SWIOTLB might not be enough and SWIOTLB may run out

Re: [PATCH v7] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-12-07 Thread Ashish Kalra
Hello Boris, On Mon, Dec 07, 2020 at 01:10:07PM +0100, Borislav Petkov wrote: > On Thu, Dec 03, 2020 at 03:25:59AM +0000, Ashish Kalra wrote: > > diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c > > index 1bcfbcd2bfd7..46549bd3d840 100644 > > --- a/arch

[PATCH v7] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-12-02 Thread Ashish Kalra
From: Ashish Kalra For SEV, all DMA to and from guest has to use shared (un-encrypted) pages. SEV uses SWIOTLB to make this happen without requiring changes to device drivers. However, depending on workload being run, the default 64MB of SWIOTLB might not be enough and SWIOTLB may run out

Re: [PATCH v6] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-11-24 Thread Ashish Kalra
Hello Konrad, On Mon, Nov 23, 2020 at 10:56:31PM +, Ashish Kalra wrote: > Hello Konrad, > > On Mon, Nov 23, 2020 at 12:56:32PM -0500, Konrad Rzeszutek Wilk wrote: > > On Mon, Nov 23, 2020 at 06:06:47PM +0100, Borislav Petkov wrote: > > > On Thu, Nov 19, 2020 at

Re: [PATCH v6] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-11-23 Thread Ashish Kalra
Hello Konrad, On Mon, Nov 23, 2020 at 12:56:32PM -0500, Konrad Rzeszutek Wilk wrote: > On Mon, Nov 23, 2020 at 06:06:47PM +0100, Borislav Petkov wrote: > > On Thu, Nov 19, 2020 at 09:42:05PM +0000, Ashish Kalra wrote: > > > From: Ashish Kalra > > > > > > Fo

[PATCH v6] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-11-19 Thread Ashish Kalra
From: Ashish Kalra For SEV, all DMA to and from guest has to use shared (un-encrypted) pages. SEV uses SWIOTLB to make this happen without requiring changes to device drivers. However, depending on workload being run, the default 64MB of SWIOTLB might not be enough and SWIOTLB may run out

[PATCH v5] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-11-18 Thread Ashish Kalra
From: Ashish Kalra For SEV, all DMA to and from guest has to use shared (un-encrypted) pages. SEV uses SWIOTLB to make this happen without requiring changes to device drivers. However, depending on workload being run, the default 64MB of SWIOTLB might not be enough and SWIOTLB may run out

[PATCH v4] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-11-17 Thread Ashish Kalra
From: Ashish Kalra For SEV, all DMA to and from guest has to use shared (un-encrypted) pages. SEV uses SWIOTLB to make this happen without requiring changes to device drivers. However, depending on workload being run, the default 64MB of SWIOTLB might not be enough and SWIOTLB may run out

Re: [PATCH v3] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-11-17 Thread Ashish Kalra
Hello Konrad, On Tue, Nov 17, 2020 at 12:00:03PM -0500, Konrad Rzeszutek Wilk wrote: > .snip.. > > > > > Lets break this down: > > > > > > > > > > How does the performance improve for one single device if you > > > > > increase the SWIOTLB? > > > > > Is there a specific device/driver that you

Re: [PATCH v3] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-11-17 Thread Ashish Kalra
On Fri, Nov 13, 2020 at 04:19:25PM -0500, Konrad Rzeszutek Wilk wrote: > On Thu, Nov 05, 2020 at 09:20:45PM +0000, Ashish Kalra wrote: > > On Thu, Nov 05, 2020 at 03:20:07PM -0500, Konrad Rzeszutek Wilk wrote: > > > On Thu, Nov 05, 2020 at 07:38:28PM +, Ashish Kalra wrote: &

Re: [PATCH v3] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-11-13 Thread Ashish Kalra
Hello Konrad, On Fri, Nov 13, 2020 at 04:19:25PM -0500, Konrad Rzeszutek Wilk wrote: > On Thu, Nov 05, 2020 at 09:20:45PM +0000, Ashish Kalra wrote: > > On Thu, Nov 05, 2020 at 03:20:07PM -0500, Konrad Rzeszutek Wilk wrote: > > > On Thu, Nov 05, 2020 at 07:38:28PM +,

Re: [PATCH v3] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-11-05 Thread Ashish Kalra
On Thu, Nov 05, 2020 at 03:20:07PM -0500, Konrad Rzeszutek Wilk wrote: > On Thu, Nov 05, 2020 at 07:38:28PM +0000, Ashish Kalra wrote: > > On Thu, Nov 05, 2020 at 02:06:49PM -0500, Konrad Rzeszutek Wilk wrote: > > > . > > > > > Right, so I am w

Re: [PATCH v3] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-11-05 Thread Ashish Kalra
gt; > > > and reserve_crashkernel() which use the allocated > > > > > > SWIOTLB buffer size, hence calling it explicitly > > > > > > from setup_arch(). > > > > > > > > > > > > The SWIOTLB default size adjustment is added as an > > &g

Re: [PATCH v3] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-11-05 Thread Ashish Kalra
Hello Konrad, On Thu, Nov 05, 2020 at 12:43:17PM -0500, Konrad Rzeszutek Wilk wrote: > On Wed, Nov 04, 2020 at 10:39:13PM +0000, Ashish Kalra wrote: > > Hello Konrad, > > > > On Wed, Nov 04, 2020 at 05:14:52PM -0500, Konrad Rzeszutek Wilk wrote: > > > On Wed, No

Re: [PATCH v3] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-11-04 Thread Ashish Kalra
Hello Konrad, On Wed, Nov 04, 2020 at 05:14:52PM -0500, Konrad Rzeszutek Wilk wrote: > On Wed, Nov 04, 2020 at 10:08:04PM +0000, Ashish Kalra wrote: > > From: Ashish Kalra > > > > For SEV, all DMA to and from guest has to use shared > > (un-encrypted) page

[PATCH v3] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-11-04 Thread Ashish Kalra
From: Ashish Kalra For SEV, all DMA to and from guest has to use shared (un-encrypted) pages. SEV uses SWIOTLB to make this happen without requiring changes to device drivers. However, depending on workload being run, the default 64MB of SWIOTLB might not be enough and SWIOTLB may run out

Re: [PATCH v2] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-06-24 Thread Ashish Kalra
On Wed, Jun 24, 2020 at 12:23:57AM +, Ashish Kalra wrote: > Hello Konrad, > > On Tue, Jun 23, 2020 at 09:38:43AM -0400, Konrad Rzeszutek Wilk wrote: > > On Mon, Apr 27, 2020 at 06:53:18PM +0000, Ashish Kalra wrote: > > > Hello Konrad, > > > > > >

Re: [PATCH v2] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-06-23 Thread Ashish Kalra
Hello Konrad, On Tue, Jun 23, 2020 at 09:38:43AM -0400, Konrad Rzeszutek Wilk wrote: > On Mon, Apr 27, 2020 at 06:53:18PM +0000, Ashish Kalra wrote: > > Hello Konrad, > > > > On Mon, Mar 30, 2020 at 10:25:51PM +, Ashish Kalra wrote: > > > Hello Konrad, > >

Re: [PATCH v2] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-04-27 Thread Ashish Kalra
Hello Konrad, On Mon, Mar 30, 2020 at 10:25:51PM +, Ashish Kalra wrote: > Hello Konrad, > > On Tue, Mar 03, 2020 at 12:03:53PM -0500, Konrad Rzeszutek Wilk wrote: > > On Tue, Feb 04, 2020 at 07:35:00PM +0000, Ashish Kalra wrote: > > > Hello Konrad, > > > &g

Re: [PATCH v2] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-03-30 Thread Ashish Kalra
Hello Konrad, On Tue, Mar 03, 2020 at 12:03:53PM -0500, Konrad Rzeszutek Wilk wrote: > On Tue, Feb 04, 2020 at 07:35:00PM +0000, Ashish Kalra wrote: > > Hello Konrad, > > > > Looking fwd. to your feedback regarding support of other memory > > encryption architectur

Re: [PATCH v2] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-03-11 Thread Ashish Kalra
On Tue, Mar 03, 2020 at 12:03:53PM -0500, Konrad Rzeszutek Wilk wrote: > > > > > > >> > > > >>Actually you seem to be piggybacking on pci_swiotlb_detect_4gb - so > > > >>perhaps add in this code ? Albeit it really should be in it's own > > > >>file, not in

Re: [PATCH v2] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-02-04 Thread Ashish Kalra
Hello Konrad, Looking fwd. to your feedback regarding support of other memory encryption architectures such as Power, S390, etc. Thanks, Ashish On Fri, Jan 24, 2020 at 11:00:08PM +, Ashish Kalra wrote: > On Tue, Jan 21, 2020 at 03:54:03PM -0500, Konrad Rzeszutek Wilk wr

Re: [PATCH v2] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-01-24 Thread Ashish Kalra
On Tue, Jan 21, 2020 at 03:54:03PM -0500, Konrad Rzeszutek Wilk wrote: > > > > Additional memory calculations based on # of PCI devices and > > their memory ranges will make it more complicated with so > > many other permutations and combinations to explore, it is > > essential to keep this patch

Re: [PATCH v2] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-01-21 Thread Ashish Kalra
On Thu, Dec 19, 2019 at 08:52:45PM -0500, Konrad Rzeszutek Wilk wrote: > On Mon, Dec 09, 2019 at 11:13:46PM +0000, Ashish Kalra wrote: > > From: Ashish Kalra > > > > For SEV, all DMA to and from guest has to use shared > > (un-encrypted) pages. SEV uses SWIOTLB to m

[PATCH v2] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2019-12-09 Thread Ashish Kalra
From: Ashish Kalra For SEV, all DMA to and from guest has to use shared (un-encrypted) pages. SEV uses SWIOTLB to make this happen without requiring changes to device drivers. However, depending on workload being run, the default 64MB of SWIOTLB might not be enough and SWIOTLB may run out

[PATCH] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2019-12-05 Thread Ashish Kalra
From: Ashish Kalra For SEV, all DMA to and from guest has to use shared (un-encrypted) pages. SEV uses SWIOTLB to make this happen without requiring changes to device drivers. However, depending on workload being run, the default 64MB of SWIOTLB might not be enough and SWIOTLB may run out