From: Markus Armbruster <armbru@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org, peter.maydell@linaro.org,
vsementsov@yandex-team.ru, berrange@redhat.com,
stefanha@redhat.com, qemu-devel@nongnu.org,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH] tests/avocado/hotplug_blk: Fix addr in device_add command
Date: Sat, 23 Nov 2024 07:46:39 +0100 [thread overview]
Message-ID: <87v7we1m7k.fsf@pond.sub.org> (raw)
In-Reply-To: <20241122224042.149258-1-kwolf@redhat.com> (Kevin Wolf's message of "Fri, 22 Nov 2024 23:40:42 +0100")
Kevin Wolf <kwolf@redhat.com> writes:
> pci_devfn properties accept both integer and string values, but
> integer 1 and string '1' have different meanings: The integer value
> means device 0, function 1 whereas the string value '1' is short for
> '1.0' and means device 1, function 0.
This is a terrible interface. Goes back to
commit 768a9ebe188bd0a6172a9a4e64777d21fff7f014
Author: Paolo Bonzini <pbonzini@redhat.com>
Date: Thu Feb 9 09:53:32 2012 +0100
qdev: accept both strings and integers for PCI addresses
Visitors allow a limited form of polymorphism. Exploit it to support
setting the non-legacy PCI address property both as a DD.F string
and as an 8-bit integer.
Less than clear. Before the patch, only strings where accepted.
Afterwards, integers are accepted, too.
The 8-bit integer form is just too clumsy, it is unlikely that we will
ever drop it.
No idea what that means.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> This test wants the string version so that the device actually becomes
> visible for the guest. device_add hides the problem because it goes
> through QemuOpts, which turns all properties into strings - this is a
> QEMU bug that we want to fix, but that cancelled out the bug in this
> test.
The integer half of the terrible interface is inaccessible with
device_add. This is fixable for QMP device_add: avoid the ill-advised
detour that turns all values into strings.
It will remain inaccessible with HMP device_add and -device with dotted
key arguments: scalar values can only be strings there.
> Fix the test first so that device_add can be fixed afterwards.
Your patch fixes a misuse of the terrible interface.
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> tests/avocado/hotplug_blk.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/avocado/hotplug_blk.py b/tests/avocado/hotplug_blk.py
> index d55ded1c1d..b36bca02ec 100644
> --- a/tests/avocado/hotplug_blk.py
> +++ b/tests/avocado/hotplug_blk.py
> @@ -33,7 +33,7 @@ def plug(self) -> None:
> 'drive': 'disk',
> 'id': 'virtio-disk0',
> 'bus': 'pci.1',
> - 'addr': 1
> + 'addr': '1',
> }
>
> self.assert_no_vda()
Reviewed-by: Markus Armbruster <armbru@redhat.com>
next prev parent reply other threads:[~2024-11-23 6:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 22:40 [PATCH] tests/avocado/hotplug_blk: Fix addr in device_add command Kevin Wolf
2024-11-23 6:46 ` Markus Armbruster [this message]
2024-11-25 9:35 ` Daniel P. Berrangé
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=87v7we1m7k.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@yandex-team.ru \
/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.