From: Anthony Liguori <aliguori@us.ibm.com>
To: Alexander Graf <agraf@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org,
Christian Borntraeger <borntraeger@de.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] Fix legacy device aliases for s390
Date: Thu, 03 May 2012 07:32:36 -0500 [thread overview]
Message-ID: <4FA27AE4.4050105@us.ibm.com> (raw)
In-Reply-To: <F68AF02A-FECD-4496-9593-453BAE331C7B@suse.de>
On 05/03/2012 04:07 AM, Alexander Graf wrote:
>
> On 03.05.2012, at 11:05, Paolo Bonzini wrote:
>
>>
>>>> The usual old fix was to not even compile them in. Why are they in
>>>> the alias list in the s390 build now?
>>>
>>> Because the alias list is in target-independent code.
>>>
>>> The old fix was brittle anyway, it dependent on the fact that
>>> virtio-blk-pci was not part of libhw. A similar trick broke for
>>> cirrus-vga when it became part of libhw.
>>>
>>> Christian fix is correct.
>>
>> Uhm, Christian fix would have the same problem actually if
>> virtio-*-pci were to be moved in libhw. IIRC I proposed the
>> same change on review and Anthony nacked it on these grounds.
>> You could move the alias list to target-dependent code, though.
>
> Can't we just make the virtio-*-pci variants fail instantiation and based on that search the list on?
No, but you could do:
diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c
index dc4e4e1..f90966f 100644
--- a/hw/qdev-monitor.c
+++ b/hw/qdev-monitor.c
@@ -29,16 +29,17 @@ typedef struct QDevAlias
{
const char *typename;
const char *alias;
+ uint32_t arch_mask;
} QDevAlias;
static const QDevAlias qdev_alias_table[] = {
- { "virtio-blk-pci", "virtio-blk" },
- { "virtio-net-pci", "virtio-net" },
- { "virtio-serial-pci", "virtio-serial" },
- { "virtio-balloon-pci", "virtio-balloon" },
- { "virtio-blk-s390", "virtio-blk" },
- { "virtio-net-s390", "virtio-net" },
- { "virtio-serial-s390", "virtio-serial" },
+ { "virtio-blk-pci", "virtio-blk", QEMU_ARCH_ALL & ~QEMU_ARCH_S390X },
+ { "virtio-net-pci", "virtio-net", QEMU_ARCH_ALL & ~QEMU_ARCH_S390X },
+ { "virtio-serial-pci", "virtio-serial", QEMU_ARCH_ALL & ~QEMU_ARCH_S390X },
+ { "virtio-balloon-pci", "virtio-balloon", QEMU_ARCH_ALL & ~QEMU_ARCH_S390X },
+ { "virtio-blk-s390", "virtio-blk", QEMU_ARCH_S390X },
+ { "virtio-net-s390", "virtio-net", QEMU_ARCH_S390X },
+ { "virtio-serial-s390", "virtio-serial", QEMU_ARCH_S390X },
{ "lsi53c895a", "lsi" },
{ "ich9-ahci", "ahci" },
{ }
@@ -110,6 +111,11 @@ static const char *find_typename_by_alias(const char *alias)
int i;
for (i = 0; qdev_alias_table[i].alias; i++) {
+ if (qdev_alias_table[i].mask &&
+ !(qdev_alias_table[i].mask & arch_type)) {
+ continue;
+ }
+
if (strcmp(qdev_alias_table[i].alias, alias) == 0) {
return qdev_alias_table[i].typename;
}
Not tested at all as I'm on holiday but if you wanted to take this patch and run
with it, I think that would be a reasonable approach.
Regards,
Anthony Liguori
>
>
> Alex
>
next prev parent reply other threads:[~2012-05-03 12:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 8:47 [Qemu-devel] [PATCH] Fix legacy device aliases for s390 Christian Borntraeger
2012-05-03 8:49 ` Alexander Graf
2012-05-03 8:53 ` Christian Borntraeger
2012-05-03 8:55 ` Alexander Graf
2012-05-03 9:03 ` Paolo Bonzini
2012-05-03 9:05 ` Paolo Bonzini
2012-05-03 9:07 ` Alexander Graf
2012-05-03 9:16 ` Paolo Bonzini
2012-05-03 12:32 ` Anthony Liguori [this message]
2012-05-03 13:34 ` Alexander Graf
2012-05-17 22:57 ` Alexander Graf
2012-05-18 0:28 ` Anthony Liguori
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=4FA27AE4.4050105@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).