From patchwork Thu May 3 12:32:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 156680 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A3FFBB7115 for ; Thu, 3 May 2012 22:35:28 +1000 (EST) Received: from localhost ([::1]:33547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPvFm-0003zq-7m for incoming@patchwork.ozlabs.org; Thu, 03 May 2012 08:35:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPvFa-0003zV-5j for qemu-devel@nongnu.org; Thu, 03 May 2012 08:35:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPvFY-0003Zj-7t for qemu-devel@nongnu.org; Thu, 03 May 2012 08:35:13 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:58350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPvFY-0003ZQ-1b for qemu-devel@nongnu.org; Thu, 03 May 2012 08:35:12 -0400 Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 3 May 2012 06:35:07 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 3 May 2012 06:33:10 -0600 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 27F923E4004E for ; Thu, 3 May 2012 06:33:01 -0600 (MDT) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q43CWbPo063980 for ; Thu, 3 May 2012 06:32:45 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q43CWbXc028284 for ; Thu, 3 May 2012 06:32:37 -0600 Received: from [9.65.93.116] (sig-9-65-93-116.mts.ibm.com [9.65.93.116]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q43CWacx028251; Thu, 3 May 2012 06:32:36 -0600 Message-ID: <4FA27AE4.4050105@us.ibm.com> Date: Thu, 03 May 2012 07:32:36 -0500 From: Anthony Liguori User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: Alexander Graf References: In-Reply-To: X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12050312-7282-0000-0000-000008B2DBA3 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.110.149 Cc: Paolo Bonzini , qemu-devel@nongnu.org, Christian Borntraeger Subject: Re: [Qemu-devel] [PATCH] Fix legacy device aliases for s390 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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: 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 > 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; }