[PATCH v2 1/1] virtio: remove deprecated VIRTIO_PCI_CONFIG()

2018-12-09 Thread Dongli Zhang
VIRTIO_PCI_CONFIG() is deprecated. Use VIRTIO_PCI_CONFIG_OFF() instead.

Signed-off-by: Dongli Zhang 
---
Changed since v1:
  * leave the definition of VIRTIO_PCI_CONFIG() in header file to make 
userspace build happy

 drivers/virtio/virtio_pci_legacy.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/virtio/virtio_pci_legacy.c 
b/drivers/virtio/virtio_pci_legacy.c
index de062fb..eff9ddc 100644
--- a/drivers/virtio/virtio_pci_legacy.c
+++ b/drivers/virtio/virtio_pci_legacy.c
@@ -52,7 +52,8 @@ static void vp_get(struct virtio_device *vdev, unsigned 
offset,
 {
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
void __iomem *ioaddr = vp_dev->ioaddr +
-   VIRTIO_PCI_CONFIG(vp_dev) + offset;
+   VIRTIO_PCI_CONFIG_OFF(vp_dev->msix_enabled) +
+   offset;
u8 *ptr = buf;
int i;
 
@@ -67,7 +68,8 @@ static void vp_set(struct virtio_device *vdev, unsigned 
offset,
 {
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
void __iomem *ioaddr = vp_dev->ioaddr +
-   VIRTIO_PCI_CONFIG(vp_dev) + offset;
+   VIRTIO_PCI_CONFIG_OFF(vp_dev->msix_enabled) +
+   offset;
const u8 *ptr = buf;
int i;
 
-- 
2.7.4

___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


[PATCH 3.16 249/328] x86/paravirt: Fix some warning messages

2018-12-09 Thread Ben Hutchings
3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Dan Carpenter 

commit 571d0563c8881595f4ab027aef9ed1c55e3e7b7c upstream.

The first argument to WARN_ONCE() is a condition.

Fixes: 5800dc5c19f3 ("x86/paravirt: Fix spectre-v2 mitigations for paravirt 
guests")
Signed-off-by: Dan Carpenter 
Signed-off-by: Thomas Gleixner 
Reviewed-by: Juergen Gross 
Cc: Peter Zijlstra 
Cc: Alok Kataria 
Cc: "H. Peter Anvin" 
Cc: virtualization@lists.linux-foundation.org
Cc: kernel-janit...@vger.kernel.org
Link: https://lkml.kernel.org/r/20180919103553.GD9238@mwanda
Signed-off-by: Ben Hutchings 
---
 arch/x86/kernel/paravirt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -99,7 +99,7 @@ unsigned paravirt_patch_call(void *insnb
 
if (len < 5) {
 #ifdef CONFIG_RETPOLINE
-   WARN_ONCE("Failing to patch indirect CALL in %ps\n", (void 
*)addr);
+   WARN_ONCE(1, "Failing to patch indirect CALL in %ps\n", (void 
*)addr);
 #endif
return len; /* call too long for patch site */
}
@@ -119,7 +119,7 @@ unsigned paravirt_patch_jmp(void *insnbu
 
if (len < 5) {
 #ifdef CONFIG_RETPOLINE
-   WARN_ONCE("Failing to patch indirect JMP in %ps\n", (void 
*)addr);
+   WARN_ONCE(1, "Failing to patch indirect JMP in %ps\n", (void 
*)addr);
 #endif
return len; /* call too long for patch site */
}

___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


Re: [RFC 3/3] virtio_ring: use new vring flags

2018-12-09 Thread Michael S. Tsirkin
On Sat, Dec 08, 2018 at 09:47:29PM +0800, Tiwei Bie wrote:
> On Fri, Dec 07, 2018 at 01:10:48PM -0500, Michael S. Tsirkin wrote:
> > On Fri, Dec 07, 2018 at 04:48:42PM +0800, Tiwei Bie wrote:
> > > Switch to using the _SPLIT_ and _PACKED_ variants of vring flags
> > > in split ring and packed ring respectively.
> > > 
> > > Signed-off-by: Tiwei Bie 
> > > ---
> > > @@ -502,7 +505,8 @@ static inline int virtqueue_add_split(struct 
> > > virtqueue *_vq,
> > >   }
> > >   }
> > >   /* Last one doesn't continue. */
> > > - desc[prev].flags &= cpu_to_virtio16(_vq->vdev, ~VRING_DESC_F_NEXT);
> > > + desc[prev].flags &= cpu_to_virtio16(_vq->vdev,
> > > + (u16)~BIT(VRING_SPLIT_DESC_F_NEXT));
> > >  
> > >   if (indirect) {
> > >   /* Now that the indirect table is filled in, map it. */
> > 
> > I kind of dislike it that this forces use of a cast here.
> > Kind of makes it more fragile. Let's use a temporary instead?
> 
> I tried something like this:
> 
> u16 mask = ~BIT(VRING_SPLIT_DESC_F_NEXT);
> 
> And it will still cause the warning:
> 
> warning: large integer implicitly truncated to unsigned type [-Woverflow]
>   u16 mask = ~BIT(VRING_SPLIT_DESC_F_NEXT);
> 
> If the cast isn't wanted, maybe use ~(1 << VRING_SPLIT_DESC_F_NEXT)
> directly?

What I'd like to see is a macro that warns/errors out if the shift is
too large. I'll think it over on the weekend.


> 
> > 
> > > -- 
> > > 2.17.1
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization