From nobody Sat May 18 19:24:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1612491684; cv=none; d=zohomail.com; s=zohoarc; b=ChILTPRb8QTDHI8UNzkwHCM0l/vK9fBXGyD4GOqSx7XFZjMDgSWunCaFQBUEbRFLD4/KRnJ7r6ZR+ekNBOzq1wez9VTI/S0UeXaKk5QhxyNxmfXHw4slW3gYjBUe4Y87J078hJMfP3xU9KONfZ4XHHgqhjGvXZ7GXAyxB4QwQv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612491684; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=kxZ08gdFWgnbbu/XoHH1SGEbS1d0c+AUA/NzfSJAkxs=; b=nc0EBIwXX1sSsuVmIqZlqRCqZiag9ZpvGAILF0OYKeaU9zXPvmdwPpBg2JKMzasTwOsDCSg7vUUbABZsrl4ujl95JUMf39wg61u3UeEeSClV0m8T522GMykqJoJjF7eAzVT+Kiq/rMjzFRXGul5Rnqn6SFhUKEfkQwVDxeIK+rg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1612491684959979.1141741577223; Thu, 4 Feb 2021 18:21:24 -0800 (PST) Received: from localhost ([::1]:49926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7qkN-0003nb-A2 for importer@patchew.org; Thu, 04 Feb 2021 21:21:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7qje-0003BJ-5f; Thu, 04 Feb 2021 21:20:38 -0500 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:46630) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l7qja-0000LA-G0; Thu, 04 Feb 2021 21:20:37 -0500 Received: by mail-io1-xd2c.google.com with SMTP id u8so5424552ior.13; Thu, 04 Feb 2021 18:20:33 -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 f8sm3472897ioh.42.2021.02.04.18.20.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 18:20:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:user-agent:mime-version :content-transfer-encoding; bh=kxZ08gdFWgnbbu/XoHH1SGEbS1d0c+AUA/NzfSJAkxs=; b=Nhb0BG1FMaP8pC9KH0Ik+XWv7hBYSN6TuAIpRocbEGm7LQXbfvMCh5aGnnc4IwltoR DoCMbELMv3/dgkorR+aXQwkfvzc0nFDnYtBs73T9i3nv/9ymMKIBk+Tn1HTVwDX2S2S1 AGfRI23P0jWVkPF4WPvd3f+fOTD5nr9qPTtIhgmru9Y4UTQa5/flV1tI+cPql2TeFX4O UzSe9dJf0tzjMbZnuib6TfE7sVvoQBb/3JIX1kUp9omwetyT3CgXB7PMUXvIJRIJipsj p0hx800xAPYd9huIOFIro978x5VMsDrFlwzKcqmr/EE1ezIzgo1vGRO1IFPBBE9oRxQk TpSw== 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:cc:date:user-agent :mime-version:content-transfer-encoding; bh=kxZ08gdFWgnbbu/XoHH1SGEbS1d0c+AUA/NzfSJAkxs=; b=YVAKeEzgas7xiz0OfslGwMe9nIscuPj99U9T+uzPkPD6/3cvisRlJAF2+1osC7gNfD tJ+zipcuby2XvLXn23UXOXU+gbF80xgcBBNXOIf1SjVEAa0E7Fl/SoNb6hN1boHeN2tY 9r5B6MNvGPtZLg3NDJdygInp2LMqUld5Qs83sW4ZfOIGGPCpJeI1yxtrLqahq2elR+4i JI1E074/w0lBwLmRcxK2sX3ZU+eUuxnnVg8r6SqZfPslkx+4mJWwUvhUeb5gKUCEWcpb thOZmuFYn+CGWlDHZoC4m2H8wvlpputpogn0pq/4TS0cPxVmZ33NkOaGei+VuQ8O6Qua lF9w== X-Gm-Message-State: AOAM533SSSsF7A8RsterA92hzFQ4tGtpCEeBKThuDTE9mrIaqifVixKh 483WI66lDj7KeoVN0aul64FRXD2Vx5uju4IkMBk= X-Google-Smtp-Source: ABdhPJz1mSOiM6goxLB7BaVN/9YG99YEPrY1xVJOTgUlnCspNz59xi2zmrVFQ8O2eCQ3l/7uxKHUcQ== X-Received: by 2002:a02:a90a:: with SMTP id n10mr2664688jam.7.1612491632681; Thu, 04 Feb 2021 18:20:32 -0800 (PST) Message-ID: Subject: [PATCH v2] arm: xlnx-versal: fix virtio-mmio base address assignment From: schspa To: qemu-devel@nongnu.org, qemu-arm Date: Fri, 05 Feb 2021 10:20:23 +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::d2c; envelope-from=schspa@gmail.com; helo=mail-io1-xd2c.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: , Cc: "Edgar E. Iglesias" , Alistair Francis , Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 commit f58b39d2d5b ("virtio-mmio: format transport base address in BusClass.get_dev_path") 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. Besides, xlnx-versal can't add sysbus_mmio_map api call too, because this will add memory region to system_memory, and it can't be added to VersalVirt.soc.fpd.apu.mr again. 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