RE: [PATCH 0/5] iommu/virtio: Add identity domains

2021-10-20 Thread Tian, Kevin
> From: Jean-Philippe Brucker > Sent: Wednesday, October 13, 2021 8:11 PM > > Support identity domains, allowing to only enable IOMMU protection for a > subset of endpoints (those assigned to userspace, for example). Users > may enable identity domains at compile time > (CONFIG_IOMMU_DEFAULT_PASS

RE: [PATCH 0/5] iommu/virtio: Add identity domains

2021-10-20 Thread Tian, Kevin
> From: Jean-Philippe Brucker > Sent: Monday, October 18, 2021 11:24 PM > > On Thu, Oct 14, 2021 at 03:00:38AM +, Tian, Kevin wrote: > > > From: Jean-Philippe Brucker > > > Sent: Wednesday, October 13, 2021 8:11 PM > > > > > > Support identity domains, allowing to only enable IOMMU protectio

RE: [PATCH 0/5] iommu/virtio: Add identity domains

2021-10-20 Thread Tian, Kevin
> From: j...@8bytes.org > Sent: Monday, October 18, 2021 7:38 PM > > On Thu, Oct 14, 2021 at 03:00:38AM +, Tian, Kevin wrote: > > I saw a concept of deferred attach in iommu core. See iommu_is_ > > attach_deferred(). Currently this is vendor specific and I haven't > > looked into the exact re

Re: [PATCH 2/2] i2c: virtio: fix completion handling

2021-10-20 Thread Viresh Kumar
On 21-10-21, 13:55, Jie Deng wrote: > Can the backend driver control the time point of interrupt injection ? I > can't think of > > why the backend has to send an early interrupt. This operation should be > avoided > > in the backend driver if possible. However, this change make sense if early >

Re: [PATCH 2/2] i2c: virtio: fix completion handling

2021-10-20 Thread Jie Deng
On 2021/10/19 15:46, Vincent Whitchurch wrote: The driver currently assumes that the notify callback is only received when the device is done with all the queued buffers. However, this is not true, since the notify callback could be called without any of the queued buffers being completed (for

Re: [PATCH V6] gpio: virtio: Add IRQ support

2021-10-20 Thread Viresh Kumar
On 20-10-21, 18:10, Andy Shevchenko wrote: > On Wednesday, October 20, 2021, Viresh Kumar > wrote: > > +static int virtio_gpio_irq_set_type(struct irq_data *d, unsigned int > > type) > > +{ > > + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); > > + struct virtio_gpio *vgpio = gp

Re: [PATCH 1/2] i2c: virtio: disable timeout handling

2021-10-20 Thread Jie Deng
On 2021/10/20 19:03, Viresh Kumar wrote: On 20-10-21, 12:55, Vincent Whitchurch wrote: If the timeout cannot be disabled, then the driver should be fixed to always copy buffers and hold on to them to avoid memory corruption in the case of timeout, as I mentioned in my commit message. That wou

Re: [RFC PATCH v4 20/20] vdpa: Add custom IOTLB translations to SVQ

2021-10-20 Thread Jason Wang
On Wed, Oct 20, 2021 at 7:57 PM Eugenio Perez Martin wrote: > > On Wed, Oct 20, 2021 at 11:03 AM Jason Wang wrote: > > > > On Wed, Oct 20, 2021 at 2:52 PM Eugenio Perez Martin > > wrote: > > > > > > On Wed, Oct 20, 2021 at 4:07 AM Jason Wang wrote: > > > > > > > > On Wed, Oct 20, 2021 at 10:02

Re: [PATCH v4 2/2] virtio_ring: check desc == NULL when using indirect with packed

2021-10-20 Thread Xuan Zhuo
On Wed, 20 Oct 2021 10:52:24 -0400, Michael S. Tsirkin wrote: > On Wed, Oct 20, 2021 at 07:07:43PM +0800, Xuan Zhuo wrote: > > On Wed, 20 Oct 2021 04:24:33 -0400, Michael S. Tsirkin > > wrote: > > > On Wed, Oct 20, 2021 at 10:19:46AM +0800, Xuan Zhuo wrote: > > > > On Tue, 19 Oct 2021 09:21:51 -

Re: [PATCH v5 07/16] x86/kvm: Use bounce buffers for TD guest

2021-10-20 Thread Tom Lendacky via Virtualization
On 10/20/21 11:50 AM, Sathyanarayanan Kuppuswamy wrote: On 10/20/21 9:39 AM, Tom Lendacky wrote: On 10/8/21 7:37 PM, Kuppuswamy Sathyanarayanan wrote: From: "Kirill A. Shutemov" Intel TDX doesn't allow VMM to directly access guest private memory. Any memory that is required for communicatio

Re: [PATCH v5 06/16] x86/tdx: Make DMA pages shared

2021-10-20 Thread Tom Lendacky via Virtualization
On 10/20/21 11:45 AM, Sathyanarayanan Kuppuswamy wrote: On 10/20/21 9:33 AM, Tom Lendacky wrote: On 10/8/21 7:37 PM, Kuppuswamy Sathyanarayanan wrote: ...   bool force_dma_unencrypted(struct device *dev)   { -    return amd_force_dma_unencrypted(dev); +    if (cc_platform_has(CC_ATTR_GUEST_T

Re: [PATCH v5 07/16] x86/kvm: Use bounce buffers for TD guest

2021-10-20 Thread Tom Lendacky via Virtualization
On 10/8/21 7:37 PM, Kuppuswamy Sathyanarayanan wrote: From: "Kirill A. Shutemov" Intel TDX doesn't allow VMM to directly access guest private memory. Any memory that is required for communication with VMM must be shared explicitly. The same rule applies for any DMA to and from TDX guest. All DM

Re: [PATCH v5 06/16] x86/tdx: Make DMA pages shared

2021-10-20 Thread Tom Lendacky via Virtualization
On 10/8/21 7:37 PM, Kuppuswamy Sathyanarayanan wrote: From: "Kirill A. Shutemov" Just like MKTME, TDX reassigns bits of the physical address for metadata. MKTME used several bits for an encryption KeyID. TDX uses a single bit in guests to communicate whether a physical page should be protected

Re: [PATCH v5 01/16] x86/mm: Move force_dma_unencrypted() to common code

2021-10-20 Thread Tom Lendacky via Virtualization
On 10/8/21 7:36 PM, Kuppuswamy Sathyanarayanan wrote: From: "Kirill A. Shutemov" Intel TDX doesn't allow VMM to access guest private memory. Any memory that is required for communication with VMM must be shared explicitly by setting the bit in page table entry. After setting the shared bit, the

Re: [PATCH v5 04/16] x86/tdx: Make pages shared in ioremap()

2021-10-20 Thread Tom Lendacky via Virtualization
On 10/8/21 7:36 PM, Kuppuswamy Sathyanarayanan wrote: From: "Kirill A. Shutemov" All ioremap()ed pages that are not backed by normal memory (NONE or RESERVED) have to be mapped as shared. Reuse the infrastructure from AMD SEV code. Note that DMA code doesn't use ioremap() to convert memory to

Re: [PATCH V6] gpio: virtio: Add IRQ support

2021-10-20 Thread Andy Shevchenko
On Wednesday, October 20, 2021, Viresh Kumar wrote: > This patch adds IRQ support for the virtio GPIO driver. Note that this > uses the irq_bus_lock/unlock() callbacks, since those operations over > virtio may sleep. > > Reviewed-by: Linus Walleij > Signed-off-by: Viresh Kumar > --- > Bartosz,

Re: [PATCH v4 2/2] virtio_ring: check desc == NULL when using indirect with packed

2021-10-20 Thread Michael S. Tsirkin
On Wed, Oct 20, 2021 at 07:07:43PM +0800, Xuan Zhuo wrote: > On Wed, 20 Oct 2021 04:24:33 -0400, Michael S. Tsirkin > wrote: > > On Wed, Oct 20, 2021 at 10:19:46AM +0800, Xuan Zhuo wrote: > > > On Tue, 19 Oct 2021 09:21:51 -0400, Michael S. Tsirkin > > > wrote: > > > > On Tue, Oct 19, 2021 at 0

[PATCH v6 0/2] virtio_ring: check desc == NULL when using indirect with packed

2021-10-20 Thread Xuan Zhuo
Fix theoretical issues in virtio_ring. v6: -EAGAIN => -ENOMEM v5: Update commit message. v4: Inside the #2 patch, virtqueue_add_indirect_packed() return -EAGAIN when desc == NULL. v3: Update commit message of the #1 patch. v2: Separate the style fix into a single patch.

[PATCH v6 2/2] virtio_ring: check desc == NULL when using indirect with packed

2021-10-20 Thread Xuan Zhuo
When using indirect with packed, we don't check for allocation failures. This patch checks that and fall back on direct. Fixes: 1ce9e6055fa ("virtio_ring: introduce packed ring support") Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 14 +++--- 1 file changed, 11 insertions(

[PATCH v6 1/2] virtio_ring: make virtqueue_add_indirect_packed prettier

2021-10-20 Thread Xuan Zhuo
Align the arguments of virtqueue_add_indirect_packed() to the open ( to make it look prettier. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/v

Re: [PATCH v4 2/2] virtio_ring: check desc == NULL when using indirect with packed

2021-10-20 Thread Xuan Zhuo
On Wed, 20 Oct 2021 04:24:33 -0400, Michael S. Tsirkin wrote: > On Wed, Oct 20, 2021 at 10:19:46AM +0800, Xuan Zhuo wrote: > > On Tue, 19 Oct 2021 09:21:51 -0400, Michael S. Tsirkin > > wrote: > > > On Tue, Oct 19, 2021 at 07:52:35PM +0800, Xuan Zhuo wrote: > > > > When using indirect with packe

Re: [PATCH v5 2/2] virtio_ring: check desc == NULL when using indirect with packed

2021-10-20 Thread Michael S. Tsirkin
On Wed, Oct 20, 2021 at 07:05:51PM +0800, Xuan Zhuo wrote: > When using indirect with packed, we don't check for allocation failures. > This patch checks that and fall back on direct. > > Fixes: 1ce9e6055fa ("virtio_ring: introduce packed ring support") > Signed-off-by: Xuan Zhuo > --- > drivers

[PATCH v5 2/2] virtio_ring: check desc == NULL when using indirect with packed

2021-10-20 Thread Xuan Zhuo
When using indirect with packed, we don't check for allocation failures. This patch checks that and fall back on direct. Fixes: 1ce9e6055fa ("virtio_ring: introduce packed ring support") Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 14 +++--- 1 file changed, 11 insertions(

[PATCH v5 0/2] virtio_ring: check desc == NULL when using indirect with packed

2021-10-20 Thread Xuan Zhuo
Fix theoretical issues in virtio_ring. v5: Update commit message. v4: Inside the #2 patch, virtqueue_add_indirect_packed() return -EAGAIN when desc == NULL. v3: Update commit message of the #1 patch. v2: Separate the style fix into a single patch. Xuan Zhuo (2): virtio_r

[PATCH v5 1/2] virtio_ring: make virtqueue_add_indirect_packed prettier

2021-10-20 Thread Xuan Zhuo
Align the arguments of virtqueue_add_indirect_packed() to the open ( to make it look prettier. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/v

Re: [PATCH 1/2] i2c: virtio: disable timeout handling

2021-10-20 Thread Viresh Kumar
On 20-10-21, 12:55, Vincent Whitchurch wrote: > If the timeout cannot be disabled, then the driver should be fixed to > always copy buffers and hold on to them to avoid memory corruption in > the case of timeout, as I mentioned in my commit message. That would be > quite a substantial change to th

Re: [PATCH 1/2] i2c: virtio: disable timeout handling

2021-10-20 Thread Vincent Whitchurch
On Wed, Oct 20, 2021 at 09:04:45AM +0200, Jie Deng wrote: > On 2021/10/20 14:41, Viresh Kumar wrote: > > On 20-10-21, 14:35, Jie Deng wrote: > >> Yes, but we need to know what's the best value to be configured for a > >> specific "other side". > >> > >> I think the "other side" should be more aware

Re: [PATCH 2/2] i2c: virtio: fix completion handling

2021-10-20 Thread Viresh Kumar
On 20-10-21, 12:38, Vincent Whitchurch wrote: > I don't quite understand how that would be safe since > virtqueue_add_sgs() can fail after a few iterations and all queued > request buffers can have FAIL_NEXT set. In such a case, we would end up > waiting forever with your proposed change, wouldn't

Re: [PATCH 2/2] i2c: virtio: fix completion handling

2021-10-20 Thread Vincent Whitchurch
On Wed, Oct 20, 2021 at 11:17:21AM +0200, Viresh Kumar wrote: > On 20-10-21, 16:54, Jie Deng wrote: > > > > On 2021/10/19 16:22, Viresh Kumar wrote: > > > On 19-10-21, 09:46, Vincent Whitchurch wrote: > > > > static void virtio_i2c_msg_done(struct virtqueue *vq) > > > > { > > > > - struc

[PATCH V6] gpio: virtio: Add IRQ support

2021-10-20 Thread Viresh Kumar
This patch adds IRQ support for the virtio GPIO driver. Note that this uses the irq_bus_lock/unlock() callbacks, since those operations over virtio may sleep. Reviewed-by: Linus Walleij Signed-off-by: Viresh Kumar --- Bartosz, The spec changes are close to merging now, I will let you know once

Re: [PATCH 2/2] i2c: virtio: fix completion handling

2021-10-20 Thread Viresh Kumar
On 20-10-21, 16:54, Jie Deng wrote: > > On 2021/10/19 16:22, Viresh Kumar wrote: > > On 19-10-21, 09:46, Vincent Whitchurch wrote: > > > static void virtio_i2c_msg_done(struct virtqueue *vq) > > > { > > > - struct virtio_i2c *vi = vq->vdev->priv; > > > + struct virtio_i2c_req *req; > > > + uns

Re: [RFC PATCH v4 20/20] vdpa: Add custom IOTLB translations to SVQ

2021-10-20 Thread Jason Wang
On Wed, Oct 20, 2021 at 2:52 PM Eugenio Perez Martin wrote: > > On Wed, Oct 20, 2021 at 4:07 AM Jason Wang wrote: > > > > On Wed, Oct 20, 2021 at 10:02 AM Jason Wang wrote: > > > > > > On Tue, Oct 19, 2021 at 6:29 PM Eugenio Perez Martin > > > wrote: > > > > > > > > On Tue, Oct 19, 2021 at 11:2

Re: [PATCH v11 2/3] tty: hvc: pass DMA capable memory to put_chars()

2021-10-20 Thread Greg KH
A: http://en.wikipedia.org/wiki/Top_post Q: Were do I find info about this thing called top-posting? A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? A: No. Q: Should I includ

Re: [PATCH 2/2] i2c: virtio: fix completion handling

2021-10-20 Thread Jie Deng
On 2021/10/19 16:22, Viresh Kumar wrote: On 19-10-21, 09:46, Vincent Whitchurch wrote: static void virtio_i2c_msg_done(struct virtqueue *vq) { - struct virtio_i2c *vi = vq->vdev->priv; + struct virtio_i2c_req *req; + unsigned int len; - complete(&vi->completion); +

Re: [PATCH V3 01/10] virtio-blk: validate num_queues during probe

2021-10-20 Thread Stefano Garzarella
On Wed, Oct 20, 2021 at 03:37:31AM -0400, Michael S. Tsirkin wrote: On Wed, Oct 20, 2021 at 09:18:17AM +0200, Stefano Garzarella wrote: On Tue, Oct 19, 2021 at 03:01:43PM +0800, Jason Wang wrote: > If an untrusted device neogitates BLK_F_MQ but advertises a zero s/neogitates/negotiates > num_q

Re: [PATCH v4 2/2] virtio_ring: check desc == NULL when using indirect with packed

2021-10-20 Thread Michael S. Tsirkin
On Wed, Oct 20, 2021 at 10:19:46AM +0800, Xuan Zhuo wrote: > On Tue, 19 Oct 2021 09:21:51 -0400, Michael S. Tsirkin > wrote: > > On Tue, Oct 19, 2021 at 07:52:35PM +0800, Xuan Zhuo wrote: > > > When using indirect with packed, we don't check for allocation failures. > > > This patch checks that a

Re: [PATCH V3 01/10] virtio-blk: validate num_queues during probe

2021-10-20 Thread Stefan Hajnoczi
On Tue, Oct 19, 2021 at 03:01:43PM +0800, Jason Wang wrote: > If an untrusted device neogitates BLK_F_MQ but advertises a zero > num_queues, the driver may end up trying to allocating zero size > buffers where ZERO_SIZE_PTR is returned which may pass the checking > against the NULL. This will lead

Re: [PATCH V3 01/10] virtio-blk: validate num_queues during probe

2021-10-20 Thread Michael S. Tsirkin
On Wed, Oct 20, 2021 at 09:18:17AM +0200, Stefano Garzarella wrote: > On Tue, Oct 19, 2021 at 03:01:43PM +0800, Jason Wang wrote: > > If an untrusted device neogitates BLK_F_MQ but advertises a zero > > s/neogitates/negotiates > > > num_queues, the driver may end up trying to allocating zero size

Re: [PATCH V3 01/10] virtio-blk: validate num_queues during probe

2021-10-20 Thread Stefano Garzarella
On Tue, Oct 19, 2021 at 03:01:43PM +0800, Jason Wang wrote: If an untrusted device neogitates BLK_F_MQ but advertises a zero s/neogitates/negotiates num_queues, the driver may end up trying to allocating zero size buffers where ZERO_SIZE_PTR is returned which may pass the checking against the

Re: [PATCH 1/2] i2c: virtio: disable timeout handling

2021-10-20 Thread Jie Deng
On 2021/10/20 14:41, Viresh Kumar wrote: On 20-10-21, 14:35, Jie Deng wrote: Yes, but we need to know what's the best value to be configured for a specific "other side". I think the "other side" should be more aware of what value is reasonable to be used. If we _really_ need that, then it wo