All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Zhenzhong Duan <zhenzhong.duan@intel.com>
Cc: pkrempa@redhat.com, mst@redhat.com, lersek@redhat.com,
	qemu-devel@nongnu.org, pbonzini@redhat.com, eblake@redhat.com
Subject: Re: [PATCH] vl: transform QemuOpts device to JSON syntax device
Date: Thu, 24 Feb 2022 12:31:21 +0100	[thread overview]
Message-ID: <YhdsiSDR60IXSAn/@redhat.com> (raw)
In-Reply-To: <20220224060653.74229-1-zhenzhong.duan@intel.com>

Am 24.02.2022 um 07:06 hat Zhenzhong Duan geschrieben:
> While there are mixed use of traditional -device option and JSON
> syntax option, QEMU reports conflict, e.x:
> 
> /usr/libexec/qemu-kvm -nodefaults \
>   -device '{"driver":"virtio-scsi-pci","id":"scsi0","bus":"pci.0","addr":"0x02.0"}' \
>   -device virtio-scsi-pci,id=scsi1,bus=pci.0
> 
> It breaks with:
> 
> qemu-kvm: -device {"driver":"virtio-scsi-pci","id":"scsi0","bus":"pci.0","addr":"0x02.0"}: PCI: slot 2 function 0 not available for virtio-scsi-pci, in use by virtio-scsi-pci
> 
> But if we reformat first -device same as the second, so only same kind
> of option for all the devices, it succeeds, vice versa. e.x:
> 
> /usr/libexec/qemu-kvm -nodefaults \
>   -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=02.0 \
>   -device virtio-scsi-pci,id=scsi1,bus=pci.0
> 
> Succeed!
> 
> Because both kind of options are inserted into their own list and
> break the order in QEMU command line during BDF auto assign. Fix it
> by transform QemuOpts into JSON syntax and insert in JSON device
> list, so the order in QEMU command line kept.
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>

This patch is incorrect and breaks several cases, which are the reason
why the QemuOpts path hasn't been changed yet.

For example, after this patch, help doesn't work any more:

$ build/qemu-system-x86_64 -device help
qemu-system-x86_64: -device help: 'help' is not a valid device model name

Any non-string property doesn't work any more in non-JSON syntax:

$ $ build/qemu-system-x86_64 -blockdev null-co,node-name=disk -device virtio-blk,drive=disk,physical_block_size=4096
qemu-system-x86_64: -device virtio-blk,drive=disk,physical_block_size=4096: Parameter 'physical_block_size' expects uint64

There may be more cases that are broken with this patch.

Kevin



  parent reply	other threads:[~2022-02-24 11:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24  6:06 [PATCH] vl: transform QemuOpts device to JSON syntax device Zhenzhong Duan
2022-02-24  9:02 ` Daniel P. Berrangé
2022-02-24  9:09   ` Peter Krempa
2022-02-24  9:13     ` Daniel P. Berrangé
2022-02-24 11:19       ` Duan, Zhenzhong
2022-02-24 11:31 ` Kevin Wolf [this message]
2022-02-25  2:02   ` Duan, Zhenzhong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YhdsiSDR60IXSAn/@redhat.com \
    --to=kwolf@redhat.com \
    --cc=eblake@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhenzhong.duan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.