From nobody Tue Nov 18 09:20:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) client-ip=209.85.128.47; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f47.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1609542744; cv=none; d=zohomail.com; s=zohoarc; b=M4KwUtm09HnD65BWOVMNCnMh+HYz72L2o7w4u5/L584hc3oiXfQhFVngpWNmeRNw3nApZi3+7WjnyQp/AdznNTDxNqJlEBFIidZEBuOjfrRUH1lpg4thuWAZN9NAm0PFDXliGDzdccrKs4A2N2McRJ5Rz6yBZ3h7475leXENpOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609542744; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AJ6DGCmp4jd6lh0s03hUoPTgsGD64Qh4DJvWtvXP8BM=; b=hfYrAg4Zz9tpkRp5COZz1RpzSCUZC3Nv+vToUYbVsPF5fYUrKmiyX4YBw5Ocb1X0t/32630+QoEoRWJWdRHN2bO4uXTindkvBxJFjwbXT7jPOkVx8nIOvtkrJN3D8ExDenB2VIZW/DpN1j2eu9oJpJh/7+AbIL0UsUuHoiAdidA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mx.zohomail.com with SMTPS id 1609542744957223.08551686353235; Fri, 1 Jan 2021 15:12:24 -0800 (PST) Received: by mail-wm1-f47.google.com with SMTP id g185so10471927wmf.3 for ; Fri, 01 Jan 2021 15:12:24 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (239.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.239]) by smtp.gmail.com with ESMTPSA id m5sm68345039wrz.18.2021.01.01.15.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 15:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AJ6DGCmp4jd6lh0s03hUoPTgsGD64Qh4DJvWtvXP8BM=; b=UQ1eN8h9rv2Y6SjGKKf4/kMRsbVov8NFQh2zHMp6wRZmPkL0RAAUf9OZCbzDuQQpq0 bPmRYtLUGfY/XgEcuT9ptmAtNy2/nk1NiyC/qAT0/TbHfwlOkg0JrkELmZno7p5S6Yre FqyBMmepbHNAtDJ5W65IqKBXY6nkHIsuBzyKLJiHpxi7wLuM+SfgKSSg4NC0f8CyKTy6 ZdtZpZ+3rjyfWp5da/IS/cLkgVZQ4g/9dGLzdx7xhJR/Vdcwpa9XbLR/CPIYumm2Oj1h W9KN0JtkVzUJvCFbBpHopSD7Ltb4kW+YWeSJQRX9yR8tyrNdh70HgaBb1WSMxwCGQoSl YLdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=AJ6DGCmp4jd6lh0s03hUoPTgsGD64Qh4DJvWtvXP8BM=; b=BhYyr8ijf97hyCHnOUymLcjTko/m9uIkYDtB9Ll71dBxswHU96LA/XQ4esZJ3qY1MY p9Nx+Bs8AmxstQu9Fk8DtIDEy2bcYWxN2uudpaAK8GFyoSR3PfszPYV5B5NLk0z/GMDo p28eVQphALmJ+ymxxAUcL+Mf4JcaL5rXnNJLgxpTd24rLNYcLYkPpRDvP1580YnRxln6 gNfLHWA/h4GJpVLWn+zjJebWDp7xUP4+Jt41mdlyL6LAgdg+YrxyWUvO4tufxekh33WI jDFlznYB4ul48DhzLG3riHsJP8M67jlWX0Y/XP3Rz0kA02tcqyXuWrHeuwG36jrvCJmh EZaA== X-Gm-Message-State: AOAM530qZkiEFRXfJBjcMxAGOSAL6UwUGxoPXEh2g0MDuRyi0sv9GF4j 8NIjYT5Q7/io4euDuKecHHs= X-Google-Smtp-Source: ABdhPJyNBZOhy9vg9jVE3duI0is1SPUozihIT6tkLhXAIt4rlzddX6JAodqOwt3v/pPjai7IFhPevg== X-Received: by 2002:a1c:7d58:: with SMTP id y85mr17169880wmc.50.1609542743189; Fri, 01 Jan 2021 15:12:23 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Aurelien Jarno , Cleber Rosa , Aleksandar Rikalo , Mark Cave-Ayland , qemu-block@nongnu.org, Artyom Tarasenko , Wainer dos Santos Moschetta , John Snow , Huacai Chen , Peter Maydell , BALATON Zoltan , Guenter Roeck Subject: [RFC PATCH 1/5] ide: Make room for flags in PCIIDEState and add one for legacy mode Date: Sat, 2 Jan 2021 00:12:11 +0100 Message-Id: <20210101231215.1870611-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210101231215.1870611-1-f4bug@amsat.org> References: <20210101231215.1870611-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) From: BALATON Zoltan We'll need a flag for implementing some device specific behaviour in via-ide but we already have a currently CMD646 specific field that can be repurposed for this and leave room for further flags if needed in the future. This patch changes the "secondary" field to "flags" and change CMD646 and its users accordingly and define a new flag for forcing legacy mode that will be used by via-ide for now. Signed-off-by: BALATON Zoltan Tested-by: Guenter Roeck Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Guenter Roeck Message-Id: <28150c05831caea5926d4c6a881f448c2827703d.1609191252.git.balato= n@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/ide/pci.h | 7 ++++++- hw/ide/cmd646.c | 6 +++--- hw/sparc64/sun4u.c | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/hw/ide/pci.h b/include/hw/ide/pci.h index d8384e1c422..75d1a32f6d2 100644 --- a/include/hw/ide/pci.h +++ b/include/hw/ide/pci.h @@ -42,6 +42,11 @@ typedef struct BMDMAState { #define TYPE_PCI_IDE "pci-ide" OBJECT_DECLARE_SIMPLE_TYPE(PCIIDEState, PCI_IDE) =20 +enum { + PCI_IDE_SECONDARY, /* used only for cmd646 */ + PCI_IDE_LEGACY_MODE +}; + struct PCIIDEState { /*< private >*/ PCIDevice parent_obj; @@ -49,7 +54,7 @@ struct PCIIDEState { =20 IDEBus bus[2]; BMDMAState bmdma[2]; - uint32_t secondary; /* used only for cmd646 */ + uint32_t flags; MemoryRegion bmdma_bar; MemoryRegion cmd_bar[2]; MemoryRegion data_bar[2]; diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index c2546314855..cfea7fca06f 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -255,8 +255,8 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Erro= r **errp) =20 pci_conf[PCI_CLASS_PROG] =3D 0x8f; =20 - pci_conf[CNTRL] =3D CNTRL_EN_CH0; // enable IDE0 - if (d->secondary) { + pci_conf[CNTRL] =3D CNTRL_EN_CH0; /* enable IDE0 */ + if (d->flags & BIT(PCI_IDE_SECONDARY)) { /* XXX: if not enabled, really disable the seconday IDE controller= */ pci_conf[CNTRL] |=3D CNTRL_EN_CH1; /* enable IDE1 */ } @@ -314,7 +314,7 @@ static void pci_cmd646_ide_exitfn(PCIDevice *dev) } =20 static Property cmd646_ide_properties[] =3D { - DEFINE_PROP_UINT32("secondary", PCIIDEState, secondary, 0), + DEFINE_PROP_BIT("secondary", PCIIDEState, flags, PCI_IDE_SECONDARY, fa= lse), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 0fa13a73302..c46baa9f489 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -674,7 +674,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, } =20 pci_dev =3D pci_new(PCI_DEVFN(3, 0), "cmd646-ide"); - qdev_prop_set_uint32(&pci_dev->qdev, "secondary", 1); + qdev_prop_set_bit(&pci_dev->qdev, "secondary", true); pci_realize_and_unref(pci_dev, pci_busA, &error_fatal); pci_ide_create_devs(pci_dev); =20 --=20 2.26.2 From nobody Tue Nov 18 09:20:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.44 as permitted sender) client-ip=209.85.128.44; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f44.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.44 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1609542750; cv=none; d=zohomail.com; s=zohoarc; b=F99o3Ninb7tYyrzowj9o7RPI91qQdVHbXVJZQQTV1eLOaqzUpSLpiP+VQUZf7FnC0Gv07QgJFTiV1iDXfDqiY1aPcz14Xd4B/iOyLKaiMmkLY4oMhhOOJ63o/lQSVr0sG3XPL0LFjN6o8fKTa4868kraU7ne700+64T4p0pG7fY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609542750; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pPknC029CfavJowHtwOqnsemwysUTgbwL3GrNj5GZCc=; b=NEgROu3Vij2d5a1KB6iV4fsCwmKZZLxttApznEBLH+h/lsKHQu1OBCpCGwgIfhQGCx/UzzkAza3D6Yw2o7BRQYYH9l71RIFW/3LyMyoYmUACBFC2ddnonFoSJ0uudexWcDZLa7AY6zNWNp9RuiwMQNvWo1mPvI68x/ruSw+K3KM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.44 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mx.zohomail.com with SMTPS id 16095427501721003.2015783903333; Fri, 1 Jan 2021 15:12:30 -0800 (PST) Received: by mail-wm1-f44.google.com with SMTP id 3so10455115wmg.4 for ; Fri, 01 Jan 2021 15:12:29 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (239.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.239]) by smtp.gmail.com with ESMTPSA id g78sm18705835wme.33.2021.01.01.15.12.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 15:12:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pPknC029CfavJowHtwOqnsemwysUTgbwL3GrNj5GZCc=; b=U6F8DnS5IBogNbJNUYE37Kq3jPFEFoQO8TVo75+2KJZnImnxETNU/i9I4+afpspRiY KckjcLJtsAdgTob969t1uaQVIo9Dj+Kc2b0fjX+kduPbKGLHqTUK3CPR4R0HvD7AoraA iko38/NM8LFE2KcMvDForW60eM+L7cog0XF4gMoTTk21xAqi9DMHEUtmjYh+4mEO38rK eW2IN/G7gByB4FXFsga8KM3E8KKQTakP8icFAsJ5VrvfUz3NLnx+uOUcXcvL+VMlq5kg JEqyIC91rkxN6NsVDJrdJE/Dm9KJNfKlfaM9G2xiyqkBMcfGNUWNK/phHUssPkLN4NCH h/Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=pPknC029CfavJowHtwOqnsemwysUTgbwL3GrNj5GZCc=; b=N2cuCfGa3AeS/Gawh9PF/vIr9QXtGPxl1kdC5yQl40Jxdhf44dfvaWIgPOivuAtv5E Hmf1Zhhfmk9boo6v3ZXnn99Z5dTUjgb/9rAsQKWDLFNxV09Ivh3okj/tuDjyElpGvgi/ C4yircv4ZiJexyRbV5rK5LcdSOUc0WAVgzcuXDGVkwJJdLUcTZeFaJPtWRYitKNund6F 8ndlBFrDmaUp4IkJB3ZKO6AExxw01g1B/G4D03u0MNQmu2XsNRL3lHOHuFaYBDjQLxVE Nbps6SoGWeh6v/kzbAmyoocqL+buVdEP/CfN0+Af7VXsm38wlEz5vu9ogMY6ckTbcbrs vSuQ== X-Gm-Message-State: AOAM533r3boT79QvHKO4zROTl2XGyhhhYJQJdAhJhwuIIDiGcdLTXBE8 N5PZeKDSvxcFklydShgqiIU= X-Google-Smtp-Source: ABdhPJxp5l1KvDxEAAUhLV3oVUkL3YoMIrfWmnxy6fVtdE09xyZ4RX4gal0NtFUCma98vOCQQBUrIA== X-Received: by 2002:a7b:c24d:: with SMTP id b13mr17101502wmj.151.1609542748418; Fri, 01 Jan 2021 15:12:28 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Aurelien Jarno , Cleber Rosa , Aleksandar Rikalo , Mark Cave-Ayland , qemu-block@nongnu.org, Artyom Tarasenko , Wainer dos Santos Moschetta , John Snow , Huacai Chen , Peter Maydell , Guenter Roeck , BALATON Zoltan Subject: [RFC PATCH 2/5] via-ide: Fix fuloong2e support Date: Sat, 2 Jan 2021 00:12:12 +0100 Message-Id: <20210101231215.1870611-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210101231215.1870611-1-f4bug@amsat.org> References: <20210101231215.1870611-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) From: Guenter Roeck The IDE legacy mode emulation has been removed in commit 4ea98d317eb ("ide/via: Implement and use native PCI IDE mode") but some Linux kernels (probably including def_config) require legacy mode on the Fuloong2e so only emulating native mode did not turn out feasible. Add property to via-ide model to make the mode configurable, and set legacy mode for Fuloong2e. [balaton: Use bit in flags for property, add comment for missing BAR4] Signed-off-by: Guenter Roeck Signed-off-by: BALATON Zoltan Tested-by: Guenter Roeck Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Jiaxun Yang Message-Id: <17a50e58e6baa26440c7dac83f07fdbba1595439.1609191252.git.balato= n@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/ide/via.c | 19 +++++++++++++++++-- hw/mips/fuloong2e.c | 4 +++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/hw/ide/via.c b/hw/ide/via.c index be09912b334..2d935b910f8 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -26,6 +26,7 @@ =20 #include "qemu/osdep.h" #include "hw/pci/pci.h" +#include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "qemu/module.h" #include "sysemu/dma.h" @@ -185,12 +186,19 @@ static void via_ide_realize(PCIDevice *dev, Error **e= rrp) &d->bus[1], "via-ide1-cmd", 4); pci_register_bar(dev, 3, PCI_BASE_ADDRESS_SPACE_IO, &d->cmd_bar[1]); =20 - bmdma_setup_bar(d); - pci_register_bar(dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar); + if (!(d->flags & BIT(PCI_IDE_LEGACY_MODE))) { + /* Missing BAR4 will make Linux driver fall back to legacy PIO mod= e */ + bmdma_setup_bar(d); + pci_register_bar(dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar); + } =20 qdev_init_gpio_in(ds, via_ide_set_irq, 2); for (i =3D 0; i < 2; i++) { ide_bus_new(&d->bus[i], sizeof(d->bus[i]), ds, i, 2); + if (d->flags & BIT(PCI_IDE_LEGACY_MODE)) { + ide_init_ioport(&d->bus[i], NULL, i ? 0x170 : 0x1f0, + i ? 0x376 : 0x3f6); + } ide_init2(&d->bus[i], qdev_get_gpio_in(ds, i)); =20 bmdma_init(&d->bus[i], &d->bmdma[i], d); @@ -210,6 +218,12 @@ static void via_ide_exitfn(PCIDevice *dev) } } =20 +static Property via_ide_properties[] =3D { + DEFINE_PROP_BIT("legacy-mode", PCIIDEState, flags, PCI_IDE_LEGACY_MODE, + false), + DEFINE_PROP_END_OF_LIST(), +}; + static void via_ide_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -223,6 +237,7 @@ static void via_ide_class_init(ObjectClass *klass, void= *data) k->device_id =3D PCI_DEVICE_ID_VIA_IDE; k->revision =3D 0x06; k->class_id =3D PCI_CLASS_STORAGE_IDE; + device_class_set_props(dc, via_ide_properties); set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } =20 diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 45c596f4fe5..d334fde389f 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -253,7 +253,9 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus,= int slot, qemu_irq intc, /* Super I/O */ isa_create_simple(isa_bus, TYPE_VT82C686B_SUPERIO); =20 - dev =3D pci_create_simple(pci_bus, PCI_DEVFN(slot, 1), "via-ide"); + dev =3D pci_new(PCI_DEVFN(slot, 1), "via-ide"); + qdev_prop_set_bit(&dev->qdev, "legacy-mode", true); + pci_realize_and_unref(dev, pci_bus, &error_fatal); pci_ide_create_devs(dev); =20 pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), "vt82c686b-usb-uhci"); --=20 2.26.2 From nobody Tue Nov 18 09:20:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.48 as permitted sender) client-ip=209.85.128.48; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f48.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1609542755; cv=none; d=zohomail.com; s=zohoarc; b=lcAA+NNfDU4/Z3vm8mnJeqAVl2wKFrvnvJ0AAiGw0CP4+Iou1aBns8aRK74lahqWCy0VQ2UQONBKqRnbhWwxvA3cnlgKRTsmazU7fKoFsC1LhEe5rP7TiIEGHGnZfeSAl0R6LEyt75o8kBr/Qa5KTMLMi0J8dGpA+QRn2nRNzJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609542755; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ljyxQOUNZGYTQa01IhKR46X5cyTNgh71UVYnn7BF/T8=; b=fgKb/ueOxwfi1mwTrJFyk6EKoUt0wd9fDaWZxIkrOwekrabMBHHnfg9UmUkECgUZHS/Pty9nMrWeME5TpsMtAadNQ6iRakypJe0RjZ98tCnW/O2EsHCh4KMgBHiq4iIo4iGdA5mQNWZwsxJi80+uRt6h8mbRWyhfQvrrZ4a5jrM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mx.zohomail.com with SMTPS id 1609542755148954.6213871806099; Fri, 1 Jan 2021 15:12:35 -0800 (PST) Received: by mail-wm1-f48.google.com with SMTP id 190so10274305wmz.0 for ; Fri, 01 Jan 2021 15:12:34 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (239.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.239]) by smtp.gmail.com with ESMTPSA id x17sm76034444wro.40.2021.01.01.15.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 15:12:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ljyxQOUNZGYTQa01IhKR46X5cyTNgh71UVYnn7BF/T8=; b=gj9aAg3lEBFkGyYqrbofjYq+WHyHo97p20dac3t2B96uP7gx03O3DbJSfL06Pw4afl MKvcuJc5BIUJnRGBt8TknJzZLRHJ4ZBZCkyCUiFbPJzwDZhWJFWUW3rjrWUYDn/B+i3F b5ml/yS0rBVKipruBt9vHyoysstW/DlKg5HsomBxyGUmXSvQEJ02pNtUbVshBeDIjCM8 wgKY2L0xufQM3LH5F11hSDb+f0v/7Fg9X6hv3/BWvxJfMvogvZIP4dkTZW5N2MwOxUFf Q5Y5dTuSiuj0rawNaIJRY3b7/jaGQgXkbW6n9xbQhS+3pzi+ioohk7ekWaKxWCcdPFS1 kiZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ljyxQOUNZGYTQa01IhKR46X5cyTNgh71UVYnn7BF/T8=; b=X3wrGhZWuAnzFM/w7Ww+7ZfNBmkoCmLl5uoIoppWDgeDBBRfuxOQPTIu3pG5dt97+V NGq/yXkBO1ahRiwnV7gqJ3BLNRpcTl5+iqtev0YPSnAIP9uZ2TyvXZ+kIGRWZXla6wJy gfA56Z3SY7LJVaI5IFY+tG+RnDJP/kjln0jvKyH6a/JTYeCbchMm24wkaCxzEWv++6OS sq50Ns11XBNQPsRcytPyFXsg3tYnrvAGh6W9zWlaKrIFJT+s6fcmHV0NnfKwQodXMUQ1 gXvosVL4uWqANh05+6sEaa0sYVpXjVUFnaw3JxeCH8zQ6StCgoKFA4TubZoWxVwTw0CY jMbw== X-Gm-Message-State: AOAM533sITD2PEmGg9JIL04cGAdL1Mp262L8vy0AdZjpDXmkCTADAViM vJGT8GvSzQ7+Qi5R5oN+NaU= X-Google-Smtp-Source: ABdhPJzHbswv049B7rC0m2xISqgFQL9fayJbvpZrC9bXRYHh2Z9ZhTl7pJUSHkxPK8VFQWoxe/7oiw== X-Received: by 2002:a1c:24c4:: with SMTP id k187mr17661109wmk.14.1609542753397; Fri, 01 Jan 2021 15:12:33 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Aurelien Jarno , Cleber Rosa , Aleksandar Rikalo , Mark Cave-Ayland , qemu-block@nongnu.org, Artyom Tarasenko , Wainer dos Santos Moschetta , John Snow , Huacai Chen , Peter Maydell Subject: [RFC PATCH 3/5] hw/pci-host/bonito: Remap PCI "lo" regions when PCIMAP reg is modified Date: Sat, 2 Jan 2021 00:12:13 +0100 Message-Id: <20210101231215.1870611-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210101231215.1870611-1-f4bug@amsat.org> References: <20210101231215.1870611-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Per the datasheet (Chapter 5.7.1. "PCI address regions"), the PCIMAP register: Map the 64Mbyte regions marked "PCI_Lo" in the CPU's memory map, each of which can be assigned to any 64 Mbyte-aligned region of PCI memory. The address appearing on the PCI bus consists of the low 26 bits of the CPU physical address, with the high 6 bits coming from the appropriate base6 field. Each of the three regions is an independent window onto PCI memory, and can be positioned on any 64Mbyte boundary in PCI space. Remap the 3 regions on reset and when PCIMAP is updated. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/bonito.c | 49 ++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index a99eced0657..c58eeaf504c 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -137,6 +137,10 @@ FIELD(BONGENCFG, PCIQUEUE, 12, 1) =20 /* 4. PCI address map control */ #define BONITO_PCIMAP (0x10 >> 2) /* 0x110 */ +FIELD(PCIMAP, LO0, 0, 6) +FIELD(PCIMAP, LO1, 6, 6) +FIELD(PCIMAP, LO2, 12, 6) +FIELD(PCIMAP, 2G, 18, 1) #define BONITO_PCIMEMBASECFG (0x14 >> 2) /* 0x114 */ #define BONITO_PCIMAP_CFG (0x18 >> 2) /* 0x118 */ =20 @@ -237,6 +241,7 @@ struct BonitoState { qemu_irq *pic; PCIBonitoState *pci_dev; MemoryRegion pci_mem; + MemoryRegion pcimem_lo_alias[3]; }; =20 #define TYPE_BONITO_PCI_HOST_BRIDGE "Bonito-pcihost" @@ -245,6 +250,31 @@ OBJECT_DECLARE_SIMPLE_TYPE(BonitoState, BONITO_PCI_HOS= T_BRIDGE) #define TYPE_PCI_BONITO "Bonito" OBJECT_DECLARE_SIMPLE_TYPE(PCIBonitoState, PCI_BONITO) =20 +static void bonito_remap(PCIBonitoState *s) +{ + static const char *const region_name[3] =3D { + "pci.lomem0", "pci.lomem1", "pci.lomem2" + }; + BonitoState *bs =3D BONITO_PCI_HOST_BRIDGE(s->pcihost); + + for (size_t i =3D 0; i < 3; i++) { + uint32_t offset =3D extract32(s->regs[BONITO_PCIMAP], 6 * i, 6) <<= 26; + + if (memory_region_is_mapped(&bs->pcimem_lo_alias[i])) { + memory_region_del_subregion(get_system_memory(), + &bs->pcimem_lo_alias[i]); + object_unparent(OBJECT(&bs->pcimem_lo_alias[i])); + } + + memory_region_init_alias(&bs->pcimem_lo_alias[i], OBJECT(s), + region_name[i], &bs->pci_mem, + offset, 64 * MiB); + memory_region_add_subregion(get_system_memory(), + BONITO_PCILO_BASE + i * 64 * MiB, + &bs->pcimem_lo_alias[i]); + } +} + static void bonito_writel(void *opaque, hwaddr addr, uint64_t val, unsigned size) { @@ -260,7 +290,6 @@ static void bonito_writel(void *opaque, hwaddr addr, case BONITO_BONPONCFG: case BONITO_IODEVCFG: case BONITO_SDCFG: - case BONITO_PCIMAP: case BONITO_PCIMEMBASECFG: case BONITO_PCIMAP_CFG: case BONITO_GPIODATA: @@ -282,6 +311,10 @@ static void bonito_writel(void *opaque, hwaddr addr, case BONITO_MEMSIZE: s->regs[saddr] =3D val; break; + case BONITO_PCIMAP: + s->regs[saddr] =3D val; + bonito_remap(s); + break; case BONITO_BONGENCFG: if (!(s->regs[saddr] & 0x04) && (val & 0x04)) { reset =3D 1; /* bit 2 jump from 0 to 1 cause reset */ @@ -610,6 +643,8 @@ static void bonito_reset(void *opaque) s->regs[BONITO_DQCFG] =3D 0x8; s->regs[BONITO_MEMSIZE] =3D 0x10000000; s->regs[BONITO_PCIMAP] =3D 0x6140; + + bonito_remap(s); } =20 static const VMStateDescription vmstate_bonito =3D { @@ -626,7 +661,6 @@ static void bonito_pcihost_realize(DeviceState *dev, Er= ror **errp) { PCIHostState *phb =3D PCI_HOST_BRIDGE(dev); BonitoState *bs =3D BONITO_PCI_HOST_BRIDGE(dev); - MemoryRegion *pcimem_lo_alias =3D g_new(MemoryRegion, 3); =20 memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCIHI_= SIZE); phb->bus =3D pci_register_root_bus(dev, "pci", @@ -634,17 +668,6 @@ static void bonito_pcihost_realize(DeviceState *dev, E= rror **errp) dev, &bs->pci_mem, get_system_io(), 0x28, 32, TYPE_PCI_BUS); =20 - for (size_t i =3D 0; i < 3; i++) { - char *name =3D g_strdup_printf("pci.lomem%zu", i); - - memory_region_init_alias(&pcimem_lo_alias[i], NULL, name, - &bs->pci_mem, i * 64 * MiB, 64 * MiB); - memory_region_add_subregion(get_system_memory(), - BONITO_PCILO_BASE + i * 64 * MiB, - &pcimem_lo_alias[i]); - g_free(name); - } - create_unimplemented_device("pci.io", BONITO_PCIIO_BASE, 1 * MiB); } =20 --=20 2.26.2 From nobody Tue Nov 18 09:20:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) client-ip=209.85.221.54; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f54.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1609542760; cv=none; d=zohomail.com; s=zohoarc; b=SYKZudF2/9FkOFuySNDY56oqzbs5SH/r1UZk5Il+1WyHBN0kl5vOx+atFdvTL+vNI8vIYeFmD/SOP9N+2dffzvX6JR90W6O/ICnus3FeezMLBOWY04iXwLuVRTxJg+y5mdWMm4qjfsbrbW7gnGXfnwnJFBiKpCNXrmb7eTwt2hs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609542760; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Qro7y7rQW9N9QQR+C1gkV1wlCAwyhKQjnQXxujG4TJI=; b=gmXFSS+Q3Tsr4eQI9ehb0Igkkg4YIqjdIk9TgNySWlzzyXxXFrhe9gkgPrqn7vLP7kk51cOOOTyFiDCIdGnY+Hmv5ObcSbo1KYY93hThG4monDQh+/4SOQnPNxLqkvFmWWYxIXCxrhhP/KTFR6j5MnShwpWk3OSidJ9NXrHRcpU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mx.zohomail.com with SMTPS id 1609542760257445.33179307399837; Fri, 1 Jan 2021 15:12:40 -0800 (PST) Received: by mail-wr1-f54.google.com with SMTP id q18so23414542wrn.1 for ; Fri, 01 Jan 2021 15:12:39 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (239.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.239]) by smtp.gmail.com with ESMTPSA id k18sm83074047wrd.45.2021.01.01.15.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 15:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Qro7y7rQW9N9QQR+C1gkV1wlCAwyhKQjnQXxujG4TJI=; b=HDAm5rn7idftaY29oAM293BL0vR3TKj0WppYi74Z3/mFRzKAtHacrD14NBUavxQPRC TfPxhuV9Xe1MQ4phseclN5A5N/fLr/gTk0wqNwmzr6c1SCoXE102T/fvjwQ/DWw58QxM qtPZvZ+sM88qrzapOyXMvI6VRdH//2NzvXdPTopfRTUl9Lnm6gU+G0k8Ds0CTkCXinEY RUHH3obI98nzYfU0oEMz4QU9actTLdKLWOATlBGZrc7/WDG1NNjpEjUxXfmTpBaHDyRB Kyn/m4BNr2GsntvdWTdST0GJYFvugPVNG+S8UjVjfbelXnM/1C2JJFWZ0+gAD3dxlw6L VUgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Qro7y7rQW9N9QQR+C1gkV1wlCAwyhKQjnQXxujG4TJI=; b=r1jSdpUf8d19DKOZA3mo6DOhd2C1PP9ffN0fQ0Biuv0rN4B2QrX4Ja3W1hb8C6+Csm gPUhTNnTCtTEXgo+IX3HwU4dBn1A+fUpj6pTcT0eu0hOvevUaRwlSDm3kl8w3kmhVb/F iH4/4npLbFyUPeYiSyLygXftrkU648CIBfWQFhWAEOS/YXr2CU23wv/dKbZTXvPfSvqV EfVqxwDqOoEG9qjkIWVSuxUP0eofPGgAfuqM0gy5ih43HfN+zcpvkVaUfDK2nEGWI/jS ynaqIb1/WNDHQkBDFs3OJ7NGDdeKYol0I40Fw4ZeBwXU/8ULmIPqEjytY2sp9VkCzNhx /sUA== X-Gm-Message-State: AOAM532rguczBNL3PMzMrWswlilFkO+H8XWufH0ZpCmvD6M57CwQZUjg +zpIs3YvHOEFJtyDTLmS6JQ= X-Google-Smtp-Source: ABdhPJxuKYkrI5XgnghK4rBv+8okos6om53py2Aai9snCIeVnvUODPXI9blMLZH457FWvPbIUM9z/g== X-Received: by 2002:adf:ee90:: with SMTP id b16mr70508430wro.221.1609542758551; Fri, 01 Jan 2021 15:12:38 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Aurelien Jarno , Cleber Rosa , Aleksandar Rikalo , Mark Cave-Ayland , qemu-block@nongnu.org, Artyom Tarasenko , Wainer dos Santos Moschetta , John Snow , Huacai Chen , Peter Maydell , Willian Rampazzo Subject: [RFC PATCH 4/5] tests/acceptance: Test boot_linux_console for fuloong2e Date: Sat, 2 Jan 2021 00:12:14 +0100 Message-Id: <20210101231215.1870611-5-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210101231215.1870611-1-f4bug@amsat.org> References: <20210101231215.1870611-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) From: Jiaxun Yang The kernel comes from debian archive so it's trusted. Signed-off-by: Jiaxun Yang Reviewed-by: Wainer dos Santos Moschetta Reviewed-by: Willian Rampazzo Reviewed-by: Huacai Chen Message-Id: <20201224031750.52146-9-jiaxun.yang@flygoat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/acceptance/boot_linux_console.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index cc6ec0f8c15..fb41bb7144b 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -170,6 +170,27 @@ def test_mips64el_malta(self): console_pattern =3D 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) =20 + def test_mips64el_fuloong2e(self): + """ + :avocado: tags=3Darch:mips64el + :avocado: tags=3Dmachine:fuloong2e + :avocado: tags=3Dendian:little + """ + deb_url =3D ('http://archive.debian.org/debian/pool/main/l/linux/' + 'linux-image-3.16.0-6-loongson-2e_3.16.56-1+deb8u1_mips= el.deb') + deb_hash =3D 'd04d446045deecf7b755ef576551de0c4184dd44' + deb_path =3D self.fetch_asset(deb_url, asset_hash=3Ddeb_hash) + kernel_path =3D self.extract_from_deb(deb_path, + '/boot/vmlinux-3.16.0-6-loongs= on-2e') + + self.vm.set_console() + kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE + 'console= =3DttyS0' + self.vm.add_args('-kernel', kernel_path, + '-append', kernel_command_line) + self.vm.launch() + console_pattern =3D 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) + def test_mips_malta_cpio(self): """ :avocado: tags=3Darch:mips --=20 2.26.2 From nobody Tue Nov 18 09:20:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.43 as permitted sender) client-ip=209.85.221.43; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f43.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.43 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1609542765; cv=none; d=zohomail.com; s=zohoarc; b=hLx05Er1EcaVLxYXy0nICz4Rq07ToGghAp+ClCOz3QovewVcETbfIq5lBbPeFTpepyFImUipZHWm4+psr+Yvi2jSpN4e0JKVRD2uak/1XH9pgNyA9pQ3leFzI91QfWj7CLMhLpO8QLS67T/21AQjHkoWzysy/BxJR4DUb/lW6M4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609542765; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1ZFaL/tBEiGUgBljBvstAJrPr1DQcDPzv1CfU3zzA3U=; b=jrGYHbFlW3lUzjic61Npict1tUvXcInrCl16nuLcS5PXm4wkpNPi8IBV+VoiZhW2dawhGw/ch5M9/mGlsOBIzav3n5IsURLFRWTCqfYW7ULbc3GCNOj4VyHjcu5bGE/ibduqn19D370PyfGBZux1oIzUI0Au8Nd2X3xgbv0gOhQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.43 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mx.zohomail.com with SMTPS id 1609542765925755.6830853272699; Fri, 1 Jan 2021 15:12:45 -0800 (PST) Received: by mail-wr1-f43.google.com with SMTP id d26so23327499wrb.12 for ; Fri, 01 Jan 2021 15:12:45 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (239.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.239]) by smtp.gmail.com with ESMTPSA id c4sm18477181wmf.19.2021.01.01.15.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 15:12:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1ZFaL/tBEiGUgBljBvstAJrPr1DQcDPzv1CfU3zzA3U=; b=G9jluaP0jy6YijI9Utkj31L/O3aPlj4TVxaAKGfgPlhcWG6guGK1JAwhv+8uvyN45N 7b/EXgBZWHJDP62iJEnBt/DHMHu63HpSVCPixZ8gupQBnVsA1qSdCYSqmLdjpOIs+SrA 9pNqKMKG+Nkc2a+sLwE7Utda0jwfgmc9GB2Duq1xa/OcKp+PxzdbTh/0YD/+/ugnuvWQ OZXDtlD61Kfsu4n6yOcYlnbBnci7QqJd1XZy2/to/9Qu63CFgDvrOd4BmiMZ5ZNrPRWc qMiDYOadi3u4Jmg9ZPLehj2Yt55k1OpyQekXegr63CEMIzrg9TDVStLyKq0wgzxmvmbH lQBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=1ZFaL/tBEiGUgBljBvstAJrPr1DQcDPzv1CfU3zzA3U=; b=aVVDVaCL68Jbvgrg61Qd+9OiqM09goZx4yY0Rs9EKmQiXzdgPbkGKnO132j1+6Vk3T hmWSkJhfJYvnLDjph1tNmAkmxvNmJo59gEZTMOhNJxoZLuxiOxm7citIxXciC6iIk2in ofgNUfkKBF8VtaEdNadasFOo2k1pljRy0sCDYAFZDiF6L2xKycIJr3DYp2X05Ma3w0HT nrEXZY6NGDOUDF4rxtPps+GFtGtMVTQHvk+nU+G+SNU5hl1yc47Jzbk2DFdgzeX51eyV Qgv240FQAG48bcz6bVFpWJCEcYuDqTcFd71Q/FwQTPbXvdtMX1gtUI4vc4VJY0WMZzVF BC/A== X-Gm-Message-State: AOAM531JSttR/NxW3aCx2Bl1wcR3o1HJ/l6VwctKV93o4WH1tFvFz6Ac i9kibx/eKSr7MPU+CTudzx8= X-Google-Smtp-Source: ABdhPJznecIwQf+mD9QbnIsTg9+RTIanmA+7CvjuP8M0wP+S1oaPeFBDb7/5J46W56e1Q2rKFoYqZg== X-Received: by 2002:adf:c64f:: with SMTP id u15mr66510159wrg.270.1609542763971; Fri, 01 Jan 2021 15:12:43 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Aurelien Jarno , Cleber Rosa , Aleksandar Rikalo , Mark Cave-Ayland , qemu-block@nongnu.org, Artyom Tarasenko , Wainer dos Santos Moschetta , John Snow , Huacai Chen , Peter Maydell , Guenter Roeck Subject: [RFC PATCH 5/5] tests/integration: Test Fuloong2E IDE drive, run userspace commands Date: Sat, 2 Jan 2021 00:12:15 +0100 Message-Id: <20210101231215.1870611-6-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210101231215.1870611-1-f4bug@amsat.org> References: <20210101231215.1870611-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Boot rootfs build by Guenter Roeck [*]. Full test output: $ avocado --show=3Dapp,console run -t machine:fuloong2e tests/acceptance/ Fetching asset from tests/acceptance/boot_linux_console.py:BootLinuxConso= le.test_mips64el_fuloong2e Fetching asset from tests/acceptance/boot_linux_console.py:BootLinuxConso= le.test_mips64el_fuloong2e JOB ID : 4a89d17bd6fa596220113ea9b974412c37c6cf9a JOB LOG : /home/phil/avocado/job-results/job-2021-01-01T23.54-4a89d17/= job.log (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips6= 4el_fuloong2e: console: [ 0.000000] Initializing cgroup subsys cpuset console: [ 0.000000] Initializing cgroup subsys cpu console: [ 0.000000] Initializing cgroup subsys cpuacct console: [ 0.000000] Linux version 3.16.0-6-loongson-2e (debian-kernel= @lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 Debian 3.16.56-= 1+deb8u1 (2018-05-08) console: [ 0.000000] memsize=3D256, highmemsize=3D0 console: [ 0.000000] CpuClock =3D 100000000 console: [ 0.000000] bootconsole [early0] enabled console: [ 0.000000] CPU0 revision is: 00006302 (ICT Loongson-2) console: [ 0.000000] FPU revision is: 00000501 console: [ 0.000000] Checking for the multiply/shift bug... no. console: [ 0.000000] Checking for the daddiu bug... no. console: [ 0.000000] Determined physical RAM map: console: [ 0.000000] memory: 0000000010000000 @ 0000000000000000 (usa= ble) console: [ 0.000000] memory: 0000000004000000 @ 0000000010000000 (res= erved) console: [ 0.000000] memory: 0000000003ffffff @ 000000001c000001 (res= erved) console: [ 0.000000] Initrd not found or empty - disabling initrd console: [ 0.000000] Zone ranges: console: [ 0.000000] DMA [mem 0x00000000-0x00ffffff] console: [ 0.000000] Normal [mem 0x01000000-0x0fffffff] console: [ 0.000000] Movable zone start for each node console: [ 0.000000] Early memory node ranges console: [ 0.000000] node 0: [mem 0x00000000-0x0fffffff] console: [ 0.000000] Reserving 0MB of memory at 0MB for crashkernel console: [ 0.000000] Primary instruction cache 64kB, VIPT, direct mapp= ed, linesize 32 bytes. console: [ 0.000000] Primary data cache 64kB, 4-way, VIPT, no aliases,= linesize 32 bytes console: [ 0.000000] Unified secondary cache 512kB 4-way, linesize 32 = bytes. console: [ 0.000000] Built 1 zonelists in Zone order, mobility groupin= g on. Total pages: 16327 console: [ 0.000000] Kernel command line: printk.time=3D0 console=3Dtt= yS0 root=3D/dev/sda ro panic=3D-1 noreboot console: PID hash table entries: 1024 (order: -1, 8192 bytes) console: Dentry cache hash table entries: 32768 (order: 4, 262144 bytes) console: Inode-cache hash table entries: 16384 (order: 3, 131072 bytes) console: Memory: 250752K/262144K available (5597K kernel code, 716K rwdat= a, 1548K rodata, 480K init, 581K bss, 11392K reserved) console: NR_IRQS:128 console: Console: colour dummy device 80x25 console: Calibrating delay loop... 118.60 BogoMIPS (lpj=3D237216) console: pid_max: default: 32768 minimum: 301 console: Security Framework initialized console: AppArmor: AppArmor disabled by boot time parameter console: Yama: disabled by default; enable with sysctl kernel.yama.* console: Mount-cache hash table entries: 2048 (order: 0, 16384 bytes) console: Mountpoint-cache hash table entries: 2048 (order: 0, 16384 bytes) console: Initializing cgroup subsys memory console: Initializing cgroup subsys devices console: Initializing cgroup subsys freezer console: Initializing cgroup subsys net_cls console: Initializing cgroup subsys blkio console: Initializing cgroup subsys perf_event console: Initializing cgroup subsys net_prio console: Checking for the daddi bug... no. console: ftrace: allocating 17617 entries in 18 pages console: devtmpfs: initialized console: futex hash table entries: 256 (order: -2, 6144 bytes) console: NET: Registered protocol family 16 console: vgaarb: loaded console: SCSI subsystem initialized console: PCI host bridge to bus 0000:00 console: pci_bus 0000:00: root bus resource [mem 0x14000000-0x1c000000] console: pci_bus 0000:00: root bus resource [io 0x4000-0xffff] console: pci_bus 0000:00: No busn resource found for root bus, will use [= bus 00-ff] console: via686b fix: ISA bridge console: via686b fix: ISA bridge done console: pci 0000:00:05.1: legacy IDE quirk: reg 0x10: [io 0x01f0-0x01f7] console: pci 0000:00:05.1: legacy IDE quirk: reg 0x14: [io 0x03f6] console: pci 0000:00:05.1: legacy IDE quirk: reg 0x18: [io 0x0170-0x0177] console: pci 0000:00:05.1: legacy IDE quirk: reg 0x1c: [io 0x0376] console: via686b fix: IDE console: via686b fix: IDE done console: pci 0000:00:05.4: quirk: [io 0xeee0-0xeeef] claimed by vt82c686= SMB console: pci 0000:00:07.0: BAR 6: assigned [mem 0x14000000-0x1403ffff pre= f] console: pci 0000:00:07.0: BAR 0: assigned [io 0x4000-0x40ff] console: pci 0000:00:07.0: BAR 1: assigned [mem 0x14040000-0x140400ff] console: pci 0000:00:05.2: BAR 4: assigned [io 0x4400-0x441f] console: pci 0000:00:05.3: BAR 4: assigned [io 0x4420-0x443f] console: Switched to clocksource MIPS console: NET: Registered protocol family 2 console: TCP established hash table entries: 2048 (order: 0, 16384 bytes) console: TCP bind hash table entries: 2048 (order: 0, 16384 bytes) console: TCP: Hash tables configured (established 2048 bind 2048) console: TCP: reno registered console: UDP hash table entries: 512 (order: 0, 16384 bytes) console: UDP-Lite hash table entries: 512 (order: 0, 16384 bytes) console: NET: Registered protocol family 1 console: PCI: Enabling device 0000:00:05.2 (0000 -> 0001) console: PCI: Enabling device 0000:00:05.3 (0000 -> 0001) console: audit: initializing netlink subsys (disabled) console: audit: type=3D2000 audit(1609541667.424:1): initialized console: HugeTLB registered 32 MB page size, pre-allocated 0 pages console: zbud: loaded console: VFS: Disk quotas dquot_6.5.2 console: Dquot-cache hash table entries: 2048 (order 0, 16384 bytes) console: msgmni has been set to 489 console: alg: No test for stdrng (krng) console: Block layer SCSI generic (bsg) driver version 0.4 loaded (major = 252) console: io scheduler noop registered console: io scheduler deadline registered console: io scheduler cfq registered (default) console: Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled console: console [ttyS0] disabled console: serial8250.0: ttyS0 at I/O 0x3f8 (irq =3D 4, base_baud =3D 11520= 0) is a 16550A console: console [ttyS0] enabled console: console [ttyS0] enabled console: bootconsole [early0] disabled console: bootconsole [early0] disabled console: pata_via 0000:00:05.1: BMDMA: BAR4 is zero, falling back to PIO console: scsi0 : pata_via console: scsi1 : pata_via console: ata1: PATA max PIO4 cmd 0x1f0 ctl 0x3f6 irq 14 console: ata2: PATA max PIO4 cmd 0x170 ctl 0x376 irq 15 console: serio: i8042 KBD port at 0x60,0x64 irq 1 console: serio: i8042 AUX port at 0x60,0x64 irq 12 console: mousedev: PS/2 mouse device common for all mice console: rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0 console: rtc_cmos rtc_cmos: alarms up to one day, 114 bytes nvram console: ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100 console: ata1.00: 15320 sectors, multi 16: LBA48 console: ledtrig-cpu: registered to indicate activity on CPUs console: TCP: cubic registered console: NET: Registered protocol family 10 console: input: AT Raw Set 2 keyboard as /devices/platform/i8042/serio0/i= nput/input0 console: ata1.00: configured for PIO4 console: mip6: Mobile IPv6 console: NET: Registered protocol family 17 console: mpls_gso: MPLS GSO support console: registered taskstats version 1 console: rtc_cmos rtc_cmos: setting system clock to 2021-01-01 22:54:20 U= TC (1609541660) console: scsi 0:0:0:0: Direct-Access ATA QEMU HARDDISK 2.5+ P= Q: 0 ANSI: 5 console: input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i804= 2/serio1/input/input2 console: sd 0:0:0:0: [sda] 15320 512-byte logical blocks: (7.84 MB/7.48 M= iB) console: sd 0:0:0:0: [sda] Write Protect is off console: sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doe= sn't support DPO or FUA console: sda: unknown partition table console: sd 0:0:0:0: [sda] Attached SCSI disk console: EXT4-fs (sda): mounting ext3 file system using the ext4 subsystem console: EXT4-fs (sda): mounted filesystem with ordered data mode. Opts: = (null) console: VFS: Mounted root (ext3 filesystem) readonly on device 8:0. console: Freeing unused kernel memory: 480K (ffffffff808b8000 - ffffffff8= 0930000) console: random: nonblocking pool is initialized console: EXT4-fs (sda): re-mounted. Opts: errors=3Dremount-ro,data=3Dorde= red console: Boot successful. console: cat /proc/cpuinfo console: / # cat /proc/cpuinfo console: system type : lemote-fuloong-2e-box console: machine : Unknown console: processor : 0 console: cpu model : ICT Loongson-2 V0.2 FPU V0.1 console: BogoMIPS : 118.60 console: wait instruction : nouname -a console: microsecond timers : yes console: tlb_entries : 64 console: extra interrupt vector : no console: hardware watchpoint : yes, count: 0, address/irw mask: [] console: isa : mips1 mips2 mips3 console: ASEs implemented : console: shadow register sets : 1 console: kscratch registers : 0 console: package : 0 console: core : 0 console: VCED exceptions : not available console: VCEI exceptions : not available console: / # uname -a console: Linux (none) 3.16.0-6-loongson-2e #1 Debian 3.16.56-1+deb8u1 (20= 18-05-08) mips64 GNU/Linux console: reboot console: / # reboot console: / # umount: devtmpfs busy - remounted read-only console: EXT4-fs (sda): re-mounted. Opts: (null) console: The system is going down NOW! console: Sent SIGTERM to all processes console: Sent SIGKILL to all processes console: Requesting system reboot console: sd 0:0:0:0: [sda] Synchronizing SCSI cache console: reboot: Restarting system PASS (8.44 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | = CANCEL 0 JOB TIME : 8.85 s [*] https://github.com/groeck/linux-build-test/ Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Willian Rampazzo --- Cc: Guenter Roeck --- tests/acceptance/boot_linux_console.py | 30 ++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index fb41bb7144b..91fdd3c4cb2 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -183,13 +183,39 @@ def test_mips64el_fuloong2e(self): kernel_path =3D self.extract_from_deb(deb_path, '/boot/vmlinux-3.16.0-6-loongs= on-2e') =20 + rootfs_url =3D ('https://github.com/groeck/linux-build-test/' + 'raw/8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/' + 'rootfs/mipsel64/rootfs.mipsel.ext3.gz') + rootfs_hash =3D '4316abb84b3b8384e124ada7fc72ef8cd5577dac' + rootfs_path_gz =3D self.fetch_asset(rootfs_url, asset_hash=3Drootf= s_hash) + rootfs_path =3D os.path.join(self.workdir, 'rootfs.mipsel.ext3') + archive.gzip_uncompress(rootfs_path_gz, rootfs_path) + self.vm.set_console() - kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE + 'console= =3DttyS0' + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'console=3DttyS0 ' + + 'root=3D/dev/sda ro ' + + 'panic=3D-1 noreboot') self.vm.add_args('-kernel', kernel_path, - '-append', kernel_command_line) + '-drive', 'if=3Dnone,format=3Draw,id=3Ddisk0,file= =3D' + + rootfs_path, + '-device', 'ide-hd,bus=3Dide.0,drive=3Ddisk0', + '-append', kernel_command_line, + '-no-reboot') self.vm.launch() + console_pattern =3D 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + self.wait_for_console_pattern('Boot successful.') + + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'BogoMIPS') + exec_command_and_wait_for_pattern(self, 'uname -a', + 'Debian') + exec_command_and_wait_for_pattern(self, 'reboot', + 'reboot: Restarting system= ') + # Wait for VM to shut down gracefully + self.vm.wait() =20 def test_mips_malta_cpio(self): """ --=20 2.26.2