From nobody Sat May 18 18:02:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1612422021; cv=none; d=zohomail.com; s=zohoarc; b=MhKG8vmMOtDZEbq5Er7X+p4Q7ApHQ4F53a9Xt0sTnEKeOMQQlUJY0Ll2KhMIS+7EXYsPyRUuTJYXqX9mO74DjUWIV0n4hvGcAR1EwkGHGYGEW71uFAx0dZR8RtRs2HhMwhN7+2RNwc1vzRcygXh4ONYgQaF+AULJBXlP33vliyQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612422021; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=rMAll4xewdl8R6EJ6rvmNvubbx2IgHPMT8zmUwgxp8A=; b=I50FYTkvF345Z89XF9qqNpmkO0VUtWrzO2CMt3I/6o/8mktxerhVoxF1GORH3yImx8FbS+31tvCFxJtBQRMzF5cWfFwFjWQZyfSngjYZTNTkULdh4zKeM5k10b0EbAsNFkTuWdtG7upP2A3ZqalfmuCzRg1tMZxa3BySjnNesrc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612422021163667.9818087882625; Wed, 3 Feb 2021 23:00:21 -0800 (PST) Received: from localhost ([::1]:43584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7Ycl-0003kC-KA for importer@patchew.org; Thu, 04 Feb 2021 02:00:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7YbQ-0002qg-8u for qemu-devel@nongnu.org; Thu, 04 Feb 2021 01:58:56 -0500 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]:40500) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l7YbO-0004XP-6U for qemu-devel@nongnu.org; Thu, 04 Feb 2021 01:58:56 -0500 Received: by mail-io1-xd33.google.com with SMTP id n2so2115901iom.7 for ; Wed, 03 Feb 2021 22:58:53 -0800 (PST) Received: from [127.0.0.1] (ec2-3-14-82-192.us-east-2.compute.amazonaws.com. [3.14.82.192]) by smtp.gmail.com with ESMTPSA id m4sm2170224ilc.53.2021.02.03.22.58.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 22:58:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:date:user-agent:mime-version :content-transfer-encoding; bh=rMAll4xewdl8R6EJ6rvmNvubbx2IgHPMT8zmUwgxp8A=; b=khPq4AhmQ31KuJN9UVKGGdxWlajl9H95Kke8RR36rbbkPoQBf7rHooevFF4Va4qQ0F GZvTL+T8LulMINqH9tPGrkszWO78o3QKjYQqRops2y48urzLTiOTQQj94nev+CUGUJRo vJqXk6aTHv/R0ofO8CcD8IEq44mMulT3GuNa2HwJiz5PphnzL2xJnfdDbQqnXcgZBAYH psVaIQAwJyRPspwf3Vwx7Pv6Zt7y84XOfAD3/sct5JixeYjo4gpQvejg8xevmCAgwkaL dVVemNVZ4yb33d1DJfq0gOjGJ5OjjPCbnyJlyyYklotFfKZJX7BhoNUNLLvaZjDPjPvQ vJhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:user-agent :mime-version:content-transfer-encoding; bh=rMAll4xewdl8R6EJ6rvmNvubbx2IgHPMT8zmUwgxp8A=; b=pUMzDznnqqCACL3dn3ti7wK+3w/R/tRgQyUyNqSg74h0+rrNNFm5zNFpOOjNmXoZc7 y0haXaDmZhKLJ+IJSLYrbKZ9JVLeE4774oSfm8k7TmkS5VlRkvhrk0ZQsiALmFRxtDAY C90uqBsxOXpv6tr6Md6JPF/m19CLXS2NpoGe1aMPdsI45QToxczwOdJkCDZ/ds98WPkM /nZG5xWSjoemqa1qTfyKOrJaAzWINXa4Gm+9KqDgdwuglBWJey/MaVuHlpysqrFA3tbq 58aXeOh6ruT/RpDZWRcUp2YbrzDh7k1Wuepr6FHypLV3jSvQwRzpbBDMBcjOkKpaCT5G upNA== X-Gm-Message-State: AOAM532KFCOOKH0PQEsXC6JNPGZZH51WoH8bSbUtLzWxWTHquR7YK4lW bK0o6s+qNTpe7dSipzlOSjrUf+EMTEuT/A== X-Google-Smtp-Source: ABdhPJyjGQryzLXajBDdfSHDbndvGnTaZDyTkIpATf/MWg6jjKf6+8W0NfSt3NcKxh1y68/RHjFD0Q== X-Received: by 2002:a02:7710:: with SMTP id g16mr6667484jac.83.1612421932062; Wed, 03 Feb 2021 22:58:52 -0800 (PST) Message-ID: <3362132240927a23ecca7b9d8cfd6e4130509eea.camel@gmail.com> Subject: [PATCH] arm: xlnx-versal: fix virtio-mmio base address assignment From: schspa To: qemu-devel@nongnu.org Date: Thu, 04 Feb 2021 14:58:49 +0800 Content-Type: text/plain; charset="utf-8" User-Agent: Evolution 3.38.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::d33; envelope-from=schspa@gmail.com; helo=mail-io1-xd33.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) At the moment the following QEMU command line triggers an assertion failure On xlnx-versal SOC: =C2=A0 qemu-system-aarch64 \ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 -machine xlnx-versal-virt -nographic -smp 2 = -m 128 \ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 -fsdev local,id=3Dshareid,path=3D${HOME}/wor= k,security_model=3Dnone \ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 -device virtio-9p-device,fsdev=3Dshareid,mou= nt_tag=3Dshare \ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 -fsdev local,id=3Dshareid1,path=3D${HOME}/Mu= sic,security_model=3Dnone \ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 -device virtio-9p-device,fsdev=3Dshareid1,mo= unt_tag=3Dshare1 =C2=A0 qemu-system-aarch64: ../migration/savevm.c:860: =C2=A0 vmstate_register_with_alias_id: =C2=A0 Assertion `!se->compat || se->instance_id =3D=3D 0' failed. This problem was fixed on arm virt platform in patch =C2=A0 https://lists.nongnu.org/archive/html/qemu-devel/2016-07/msg01119.html It works perfectly on arm virt platform. but there is still there on xlnx-versal SOC. The main difference between arm virt and xlnx-versal is they use different way to create virtio-mmio qdev. on arm virt, it calls sysbus_create_simple("virtio-mmio", base, pic[irq]); which will call sysbus_mmio_map internally and assign base address to subsys device mmio correctly. but xlnx-versal's implements won't do this. However, xlnx-versal can't switch to sysbus_create_simple() to create virtio-mmio device. It's because xlnx-versal's cpu use VersalVirt.soc.fpd.apu.mr as it's memory. which is subregion of system_memory. sysbus_create_simple will add virtio to system_memory, which can't be accessed by cpu. We can solve this by simply assign mmio[0].addr directly. makes virtio_mmio_bus_get_dev_path to produce correct unique device path. Signed-off-by: schspa --- =C2=A0hw/arm/xlnx-versal-virt.c | 1 + =C2=A01 file changed, 1 insertion(+) diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 8482cd6196..87b92ec6c3 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -490,6 +490,7 @@ static void create_virtio_regions(VersalVirt *s) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 object_property_add_child(= OBJECT(&s->soc), name, OBJECT(dev)); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 sysbus_realize_and_unref(S= YS_BUS_DEVICE(dev), &error_fatal); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 sysbus_connect_irq(SYS_BUS= _DEVICE(dev), 0, pic_irq); +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 SYS_BUS_DEVICE(dev)->mmio[0].ad= dr =3D base; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mr =3D sysbus_mmio_get_reg= ion(SYS_BUS_DEVICE(dev), 0); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 memory_region_add_subregio= n(&s->soc.mr_ps, base, mr); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 g_free(name); --=20 2.30.0