From patchwork Wed Jun 8 02:30:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhao xiao qiang X-Patchwork-Id: 9163231 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BEF6460467 for ; Wed, 8 Jun 2016 02:31:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4F072836B for ; Wed, 8 Jun 2016 02:31:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 982EF2836E; Wed, 8 Jun 2016 02:31:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 474132836B for ; Wed, 8 Jun 2016 02:31:51 +0000 (UTC) Received: from localhost ([::1]:54112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bATHZ-0007al-Vq for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Jun 2016 22:31:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bATHJ-0007aT-R3 for qemu-devel@nongnu.org; Tue, 07 Jun 2016 22:31:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bATHF-0007UO-Kp for qemu-devel@nongnu.org; Tue, 07 Jun 2016 22:31:32 -0400 Received: from m50-135.163.com ([123.125.50.135]:49524) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bATHE-0007UB-9p; Tue, 07 Jun 2016 22:31:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=S0bRTENfv3sApe5+nX hT3GiiOqxgj/CP2MdeGL7Ly/A=; b=Vlq5FENbK+U2Gf0tTlYjx2vsc59j+O0r1W lyG61rjCM0vYen+EQI5e2+83ItxCIxlRa9SNngYEe45BEE+UecvNmC3o2f1EgyzN HjUhS1J3pD4ReX51YRPkU0yjJquWAL5slW2aS7pxk3+QzFtUgEafByEj7QBElR4u R5mBjJLp8= Received: from localhost.localdomain (unknown [101.254.142.162]) by smtp5 (Coremail) with SMTP id D9GowAD3j6xdg1dXfCOwAQ--.50262S2; Wed, 08 Jun 2016 10:30:58 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org, peter.maydell@linaro.org, jerome.forissier@linaro.org Date: Wed, 8 Jun 2016 10:30:45 +0800 Message-Id: <1465353045-26323-1-git-send-email-zxq_yx_007@163.com> X-Mailer: git-send-email 2.1.4 X-CM-TRANSID: D9GowAD3j6xdg1dXfCOwAQ--.50262S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Ar15tryxAr13Aw1kGFy5XFb_yoW8AFyUpr W8GF1DKr1UAFW7J3yDCw47uFy5G3y8WFy2yrZrC3y8KFs0krsYkF4ak3WUtrZFgFZ5A3W2 v34rZrWDA3WfW3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jeBT5UUUUU= X-Originating-IP: [101.254.142.162] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/1tbiMwKCxlXlgtj3aAAAsA X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 123.125.50.135 Subject: [Qemu-devel] [PATCH] hw/arm: virt uart fix X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, qemu-discuss@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP commit f0d1d2c115dffc1fbaf954d0b449db05c5eb79b1 ("hw/char: QOM'ify pl011 model") break qemu-system-arm virt machine if option '-machine secure=on' is provided. The function create_uart is called twice. So make CharDriverState pointer a parameter to create_uart instead of hardcoded. Signed-off-by: xiaoqiang zhao Tested-by: Jerome Forissier --- hw/arm/virt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 8e46137..73113cf 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -525,7 +525,7 @@ static void create_gic(VirtBoardInfo *vbi, qemu_irq *pic, int type, bool secure) } static void create_uart(const VirtBoardInfo *vbi, qemu_irq *pic, int uart, - MemoryRegion *mem) + MemoryRegion *mem, CharDriverState *chr) { char *nodename; hwaddr base = vbi->memmap[uart].base; @@ -536,7 +536,7 @@ static void create_uart(const VirtBoardInfo *vbi, qemu_irq *pic, int uart, DeviceState *dev = qdev_create(NULL, "pl011"); SysBusDevice *s = SYS_BUS_DEVICE(dev); - qdev_prop_set_chr(dev, "chardev", serial_hds[0]); + qdev_prop_set_chr(dev, "chardev", chr); qdev_init_nofail(dev); memory_region_add_subregion(mem, base, sysbus_mmio_get_region(s, 0)); @@ -1259,11 +1259,11 @@ static void machvirt_init(MachineState *machine) create_gic(vbi, pic, gic_version, vms->secure); - create_uart(vbi, pic, VIRT_UART, sysmem); + create_uart(vbi, pic, VIRT_UART, sysmem, serial_hds[0]); if (vms->secure) { create_secure_ram(vbi, secure_sysmem); - create_uart(vbi, pic, VIRT_SECURE_UART, secure_sysmem); + create_uart(vbi, pic, VIRT_SECURE_UART, secure_sysmem, serial_hds[1]); } create_rtc(vbi, pic);