From nobody Sun Nov 24 09:21:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1725466584; cv=none; d=zohomail.com; s=zohoarc; b=RjRNcD51KWyc8l/XQezvAz2Fyz3o1HpIuC8Nus1vZnpW4IgKfDanet9TFXsLSM9xvhXCTz3vwrZgtso0/uIYYa0JTsZ2+AsV76oKAhw5iJMpKy7VfvrwaRiG9clbQnJcKDqmBusbXnlRSr5N1AJ640j24rnbGJxuBYDLsSo0wKw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725466584; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nn/Mzsj0J8g/Mphb+PXQ5WHUtYUEk9GjObY40SBe48s=; b=lmZ9bVim0DkDx1d2XAwfPJn46IT98X/oAYt67ARrBfcJtFbXCraGiWVjMPCvBQXtrQ+XvFv/kdVMR/7kAJoSUoM0YCadefjueSS6By0Y+M8l70hJwlncBUAoKzlMqbyXyiVqebFQCi//IURDXyU8/0kv+TS//DUWzav7pCcuwwI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1725466584475563.3361363270038; Wed, 4 Sep 2024 09:16:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.790555.1200419 (Exim 4.92) (envelope-from ) id 1slsfm-0002gl-MI; Wed, 04 Sep 2024 16:15:58 +0000 Received: by outflank-mailman (output) from mailman id 790555.1200419; Wed, 04 Sep 2024 16:15:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slsfm-0002fi-AO; Wed, 04 Sep 2024 16:15:58 +0000 Received: by outflank-mailman (input) for mailman id 790555; Wed, 04 Sep 2024 16:15:56 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slsfk-0000I6-R3 for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 16:15:56 +0000 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [2a00:1450:4864:20::234]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f6feaa82-6ad8-11ef-a0b3-8be0dac302b0; Wed, 04 Sep 2024 18:15:56 +0200 (CEST) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2f6514f23b6so19840491fa.1 for ; Wed, 04 Sep 2024 09:15:56 -0700 (PDT) Received: from gmail.com (213-67-3-247-no600.tbcn.telia.com. [213.67.3.247]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f6151881dcsm26217611fa.124.2024.09.04.09.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:15:54 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: f6feaa82-6ad8-11ef-a0b3-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725466556; x=1726071356; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nn/Mzsj0J8g/Mphb+PXQ5WHUtYUEk9GjObY40SBe48s=; b=aAnh+FEeyrd1mo7qxAuBWBCnrbCHW/amr4H/pwcwAxJUHxwVCNyvcSnZE+cPJ9naMS +Kovigp1eGbNUIr+JyO75Jchku1dx0jY5OQ3SyRRLofyALoPrZ/KFmEMdwD3y3bhqAzf MAkuZXE4qhSnMHqJ15DfPtaisM0fLYC49Ox42TZadZ3HM+FGMWOiexPqtB3h5v6N1YOe IV0cDW19onLs3vO8/njo7nkhTIYUy9RqjsFCW5sQBCvUXdYB4a/azMMAQdpuRIG3Sb4T 2xA4w6rdl11wPsOeuax/ai0d/Lc2vwdrHxCNHO6Dpcuyk96fc7fcAoDNMm1CVzHFvlW4 W53g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725466556; x=1726071356; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nn/Mzsj0J8g/Mphb+PXQ5WHUtYUEk9GjObY40SBe48s=; b=W33nRkkZgL7J5crBB1fbayoCRKXYx5VEzK8QHGVgy1h253C8lNCXjfMEcU4iVEnGfE WNGooLnXJyGJS5pT4j3C3L4gCzRoH9trAzblc4yK8bOUcci2HMBh1oiAU+VZTucxopFs r0FfsTO5WnIOxfoV0hkjdfABLQXNJVYeZ/x7jnfnUT++viFHkcO2O4pBBujqKXuGVF1l K8vbcwOkhYew0mWwMfb8HR8RAoDTglBPutxukGhwwPydVKt2pnWZQNmcZsC3sp0+QMLv kMVHh5rYkQFu7HReBf8+CqTP8bTVVAV1kJJjBhth87RM964Q5kyutQgmk1aiuu63mjus 5ZaA== X-Forwarded-Encrypted: i=1; AJvYcCUr96729X/VTjoX/YJM2petLpyZEQZcWCwXxqcz6I0iQt7dlrsZ81dH8HL6e5TiS1yLS874Pohv19A=@lists.xenproject.org X-Gm-Message-State: AOJu0YyDftWFjOeKDeq8wbrSB4bJ69/Ssq8jV5IM/+XXoaNvtCn93PRs VHT6CVrPML9gtx9+DchZ+9snlufyfLJDKLTnzM0D5U7DCwAo5Weu X-Google-Smtp-Source: AGHT+IF6S1OoJeZCF42GJKo/qiy2ZeZ6a9HHHlUxboixNuGEbZq+dI0mGFAzSTpOvJ4LlUMQwdzjQw== X-Received: by 2002:a2e:bc19:0:b0:2f5:966:c22e with SMTP id 38308e7fff4ca-2f6105d74e3mr207636241fa.11.1725466555495; Wed, 04 Sep 2024 09:15:55 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, peter.maydell@linaro.org, alex.bennee@linaro.org, xenia.ragiadakou@amd.com, jason.andryuk@amd.com, edgar.iglesias@amd.com, xen-devel@lists.xenproject.org, "Edgar E. Iglesias" Subject: [PULL v1 09/12] hw/arm: xenpvh: Reverse virtio-mmio creation order Date: Wed, 4 Sep 2024 18:15:33 +0200 Message-ID: <20240904161537.664189-10-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240904161537.664189-1-edgar.iglesias@gmail.com> References: <20240904161537.664189-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1725466586648116600 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" We've been creating the virtio-mmio devices in forwards order but since the qbus lists prepend (rather than append) entries, the virtio busses end up with decreasing base address order. Xen enables virtio-mmio nodes in forwards order so there's been a missmatch. So far, we've been working around this with an out-of-tree patch to Xen. This reverses the order making sure the virtio busses end up ordered with increasing base addresses avoiding the need to patch Xen. Signed-off-by: Edgar E. Iglesias Acked-by: Stefano Stabellini --- hw/xen/xen-pvh-common.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/xen/xen-pvh-common.c b/hw/xen/xen-pvh-common.c index 880e8143d7..295f920442 100644 --- a/hw/xen/xen-pvh-common.c +++ b/hw/xen/xen-pvh-common.c @@ -75,7 +75,18 @@ static void xen_create_virtio_mmio_devices(XenPVHMachine= State *s) { int i; =20 - for (i =3D 0; i < s->cfg.virtio_mmio_num; i++) { + /* + * We create the transports in reverse order. Since qbus_realize() + * prepends (not appends) new child buses, the decrementing loop below= will + * create a list of virtio-mmio buses with increasing base addresses. + * + * When a -device option is processed from the command line, + * qbus_find_recursive() picks the next free virtio-mmio bus in forwar= ds + * order. + * + * This is what the Xen tools expect. + */ + for (i =3D s->cfg.virtio_mmio_num - 1; i >=3D 0; i--) { hwaddr base =3D s->cfg.virtio_mmio.base + i * s->cfg.virtio_mmio.s= ize; qemu_irq irq =3D qemu_allocate_irq(xen_set_irq, NULL, s->cfg.virtio_mmio_irq_base + i); --=20 2.43.0