mbox

[PULL,v3,0/6] virtio,pci: fixes and updates

Message ID 1473971873-2966-1-git-send-email-mst@redhat.com
State New
Headers show

Pull-request

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

Message

Michael S. Tsirkin Sept. 15, 2016, 8:38 p.m. UTC
The following changes since commit d1eb8f2acba579830cf3798c3c15ce51be852c56:

  fpu: add mechanism to check for invalid long double formats (2016-09-15 12:43:18 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to a5a43875b352810d29dc27e7b0fb602eb7ef2d31:

  MAINTAINERS: add virtio-* tests (2016-09-15 23:37:16 +0300)

----------------------------------------------------------------
virtio,pci: fixes and updates

AMD IOMMU emulation
virtio feature negotiation rework

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

----------------------------------------------------------------
David Kiarie (4):
      hw/pci: Prepare for AMD IOMMU
      hw/i386/trace-events: Add AMD IOMMU trace events
      hw/i386: Introduce AMD IOMMU
      hw/i386: AMD IOMMU IVRS table

Greg Kurz (1):
      MAINTAINERS: add virtio-* tests

Maxime Coquelin (1):
      virtio-bus: Plug devices after features are negotiated

 hw/i386/amd_iommu.h            |  289 +++++++++
 hw/virtio/virtio-pci.h         |    5 +
 include/hw/acpi/aml-build.h    |    1 +
 include/hw/i386/x86-iommu.h    |   12 +
 include/hw/pci/pci.h           |    4 +-
 include/hw/virtio/virtio-bus.h |   10 +-
 hw/acpi/aml-build.c            |    2 +-
 hw/i386/acpi-build.c           |   76 ++-
 hw/i386/amd_iommu.c            | 1383 ++++++++++++++++++++++++++++++++++++++++
 hw/i386/intel_iommu.c          |    1 +
 hw/i386/x86-iommu.c            |    6 +
 hw/s390x/virtio-ccw.c          |   30 +-
 hw/virtio/virtio-bus.c         |    9 +-
 hw/virtio/virtio-pci.c         |   36 +-
 MAINTAINERS                    |    7 +
 hw/i386/Makefile.objs          |    1 +
 hw/i386/trace-events           |   29 +
 17 files changed, 1862 insertions(+), 39 deletions(-)
 create mode 100644 hw/i386/amd_iommu.h
 create mode 100644 hw/i386/amd_iommu.c

Comments

Andreas Färber Sept. 15, 2016, 8:40 p.m. UTC | #1
Am 15.09.2016 um 22:38 schrieb Michael S. Tsirkin:
> From: Greg Kurz <groug@kaod.org>
> 
> Except virtio-9p, all virtio-* tests are orphan. This patch tries to fix
> it, according to the following logic:
> 
> - when the related subsystem has its own section in MAINTAINERS, the test
>   is added there
> - otherwise it is added to the "parent" section (aka. SCSI, Network devices,
>   virtio)
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> Reviewed-by: Amit Shah <amit.shah@redhat.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  MAINTAINERS | 7 +++++++
>  1 file changed, 7 insertions(+)

Makes perfect sense, thanks for taking care.

Cheers,
Andreas
Peter Maydell Sept. 16, 2016, 10:57 a.m. UTC | #2
On 15 September 2016 at 21:38, Michael S. Tsirkin <mst@redhat.com> wrote:
> The following changes since commit d1eb8f2acba579830cf3798c3c15ce51be852c56:
>
>   fpu: add mechanism to check for invalid long double formats (2016-09-15 12:43:18 +0100)
>
> are available in the git repository at:
>
>   git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
>
> for you to fetch changes up to a5a43875b352810d29dc27e7b0fb602eb7ef2d31:
>
>   MAINTAINERS: add virtio-* tests (2016-09-15 23:37:16 +0300)
>
> ----------------------------------------------------------------
> virtio,pci: fixes and updates
>
> AMD IOMMU emulation
> virtio feature negotiation rework
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> ----------------------------------------------------------------

Fails to build on ppc64be, still:
/home/pm215/qemu/hw/i386/amd_iommu.c:245:5: error: expected ‘,’, ‘;’
or ‘}’ before ‘uint32_t’
     uint32_t reserved_3:29;
     ^
/home/pm215/qemu/hw/i386/amd_iommu.c: In function ‘amdvi_complete_ppr’:
/home/pm215/qemu/hw/i386/amd_iommu.c:588:62: error: ‘CMDCompletePPR’
has no member named ‘reserved_3’
     if (pprcomp->reserved_1 || pprcomp->reserved_2 || pprcomp->reserved_3 ||
                                                              ^
/home/pm215/qemu/hw/i386/amd_iommu.c:589:16: error: ‘CMDCompletePPR’
has no member named ‘reserved_4’
         pprcomp->reserved_4 || pprcomp->reserved_5) {
                ^
/home/pm215/qemu/hw/i386/amd_iommu.c:589:39: error: ‘CMDCompletePPR’
has no member named ‘reserved_5’
         pprcomp->reserved_4 || pprcomp->reserved_5) {
                                       ^

Missing semicolon, again, line 237.

In fact looking at this code it just looks broken. Structures
like this:

typedef struct QEMU_PACKED {
#ifdef HOST_WORDS_BIGENDIAN
    uint64_t type:4;          /* command type        */
    uint64_t reserved_1:44;
    uint64_t devid:16;        /* related devid       */
#else
    uint64_t devid:16;
    uint64_t reserved_1:44;
    uint64_t type:4;
#endif /* __BIG_ENDIAN_BITFIELD */
    uint64_t reserved_2;
} CMDInvalIntrTable;

seem to be trying to represent bit layouts in memory using
bitfields, but this is just not portable. It's not sufficient
to have a "bigendian vs littleendian" set of ifdefs.

The portable way to do this is to write the code to use
bitwise logical operations (and functions like extract64
and deposit64) to manipulate things. As a bonus you get rid
of all these host-specific #ifdefs that are tripping you
up now.

It would be nice if C bitfields worked the way this code
wants them to, but they don't, alas.

thanks
-- PMM
Michael S. Tsirkin Sept. 16, 2016, 6:53 p.m. UTC | #3
On Fri, Sep 16, 2016 at 11:57:54AM +0100, Peter Maydell wrote:
> On 15 September 2016 at 21:38, Michael S. Tsirkin <mst@redhat.com> wrote:
> > The following changes since commit d1eb8f2acba579830cf3798c3c15ce51be852c56:
> >
> >   fpu: add mechanism to check for invalid long double formats (2016-09-15 12:43:18 +0100)
> >
> > are available in the git repository at:
> >
> >   git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
> >
> > for you to fetch changes up to a5a43875b352810d29dc27e7b0fb602eb7ef2d31:
> >
> >   MAINTAINERS: add virtio-* tests (2016-09-15 23:37:16 +0300)
> >
> > ----------------------------------------------------------------
> > virtio,pci: fixes and updates
> >
> > AMD IOMMU emulation
> > virtio feature negotiation rework
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> >
> > ----------------------------------------------------------------
> 
> Fails to build on ppc64be, still:
> /home/pm215/qemu/hw/i386/amd_iommu.c:245:5: error: expected ‘,’, ‘;’
> or ‘}’ before ‘uint32_t’
>      uint32_t reserved_3:29;
>      ^
> /home/pm215/qemu/hw/i386/amd_iommu.c: In function ‘amdvi_complete_ppr’:
> /home/pm215/qemu/hw/i386/amd_iommu.c:588:62: error: ‘CMDCompletePPR’
> has no member named ‘reserved_3’
>      if (pprcomp->reserved_1 || pprcomp->reserved_2 || pprcomp->reserved_3 ||
>                                                               ^
> /home/pm215/qemu/hw/i386/amd_iommu.c:589:16: error: ‘CMDCompletePPR’
> has no member named ‘reserved_4’
>          pprcomp->reserved_4 || pprcomp->reserved_5) {
>                 ^
> /home/pm215/qemu/hw/i386/amd_iommu.c:589:39: error: ‘CMDCompletePPR’
> has no member named ‘reserved_5’
>          pprcomp->reserved_4 || pprcomp->reserved_5) {
>                                        ^
> 
> Missing semicolon, again, line 237.
> 
> In fact looking at this code it just looks broken. Structures
> like this:
> 
> typedef struct QEMU_PACKED {
> #ifdef HOST_WORDS_BIGENDIAN
>     uint64_t type:4;          /* command type        */
>     uint64_t reserved_1:44;
>     uint64_t devid:16;        /* related devid       */
> #else
>     uint64_t devid:16;
>     uint64_t reserved_1:44;
>     uint64_t type:4;
> #endif /* __BIG_ENDIAN_BITFIELD */
>     uint64_t reserved_2;
> } CMDInvalIntrTable;
> 
> seem to be trying to represent bit layouts in memory using
> bitfields, but this is just not portable. It's not sufficient
> to have a "bigendian vs littleendian" set of ifdefs.
> 
> The portable way to do this is to write the code to use
> bitwise logical operations (and functions like extract64
> and deposit64) to manipulate things. As a bonus you get rid
> of all these host-specific #ifdefs that are tripping you
> up now.
> 
> It would be nice if C bitfields worked the way this code
> wants them to, but they don't, alas.
> 
> thanks
> -- PMM

I agree, I wanted to rework this in tree but maybe best to fix it first.
I dropped all this code from tree for now.