From patchwork Wed Jan 18 09:40:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 643681 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp1655812pvb; Wed, 18 Jan 2023 01:41:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXvttNl+2qixNr87+MN+SvFVGnfytczxSgS9EPs7GUZ2ddQ6gM9UT/dY5idqqzzCzeBKwWRG X-Received: by 2002:ac8:1190:0:b0:3ac:a882:6b0 with SMTP id d16-20020ac81190000000b003aca88206b0mr35999311qtj.34.1674034860834; Wed, 18 Jan 2023 01:41:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674034860; cv=none; d=google.com; s=arc-20160816; b=Jiyr6q/FhTgsUUd1/aqoaBS30/iJEsH+XxigKXvZDCJlh/7EjjiyxzXPf6gEHMIBWk zKDUbcK4iU2LSFs3rpuTnHZJG+DFU2C9D1535WITuRDmxTcXIELIT2664tIKLfCeQe99 Z7+zRVh4jygEd6COH03eWZ4xfLk01ijx6+O5LY8wQ4D1XuQemMJpfuiQBIJW6t8QKlgA 60RjpvMd1mBn5QetK+Qw76FYyyyiCIwalDWDyW/rC6rQK8fCvmgmMKpWxMHqZijr02Ng DmN9t/uspb9jibwp+uhrSbbugcCvQerH0CIljrklZpAUNSzEGDZD23soPot3102eng0m E1Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2ZyhUeFxlkrXf9d0fxIrlwxdlHgHOET5uo6IDAqGU+I=; b=HmDB4cwd0/s26xR95ot67uBfHEJ5tFpb2DnmCiN01xisMGXvYmCNPg0w7VyF78OfZT YHIhQFQfsdbGkYxF5tKT22//veY9MUzQ3Ni7N19LIfJgcQwzReMTyhs/B16w4sQ9uSlg Vgj1oVIJB8JIdDhACa++vmFNgj/2kgXXXJiDmMwAVDB0i3vCotv+9NOnvJBMdfevZ1FE mon/WgERm7f/+9mIuw4G6jlV4EQYbBXx1Q8AM2ZgCgLqsL2kMd6hrNJHPCAWPpm6fBhy 5j4phu88l9FtdJuurTRulQEYz5cGhN7oEeK7dcNAaZKx6n23ZSj8jE+zOhu+sZvYmwjY eEig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LXkXLXrf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w14-20020a05620a424e00b006ee9af422b6si21035886qko.226.2023.01.18.01.41.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Jan 2023 01:41:00 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LXkXLXrf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pI4vs-0000Wb-Df; Wed, 18 Jan 2023 04:40:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pI4vq-0000Vo-8l for qemu-devel@nongnu.org; Wed, 18 Jan 2023 04:40:34 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pI4vo-0003Rm-Ir for qemu-devel@nongnu.org; Wed, 18 Jan 2023 04:40:33 -0500 Received: by mail-wr1-x429.google.com with SMTP id k8so18800315wrc.9 for ; Wed, 18 Jan 2023 01:40:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=2ZyhUeFxlkrXf9d0fxIrlwxdlHgHOET5uo6IDAqGU+I=; b=LXkXLXrfV/kPbAWMtkHpmDhrAzW3DlMobgZvcplTuFqQIzgmZYs/5Lhoo3zxVniiy3 AF+gh1cRMmYEOhrOeBdNom3u02t3NqW1ilcYwa5iyXPbaxxMX6+qkl3b24MLMwgsivKn aySAyZUHaNBJaFzomVQBjcsdiNNSFLWQwzqFKcrFG3v/2vi/IJ8GmRh+1vMniJIK2F8O ZetvBeBPTLCDy9iLqBeYzC5DrS2VZCNQsQwTJAK3nJyAJSPODm6pmLWRjIv041pbjgkJ Xm28TxpdNpqMr5pBGF30AuGs9F/Nk3E58MmUhcy6Ha3HesXzeUXGQHN5qx+DREi3WX1C u3IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=2ZyhUeFxlkrXf9d0fxIrlwxdlHgHOET5uo6IDAqGU+I=; b=IqdR65Ga2kUh2MyrwAkQW6lTfiw+otl1SPUpQCeHIKTzpF1lC870L5PLybiYSQdPvp BQv874CSDDRr+doUxIpGC+LyvLCtDKDneLqPlyQ706FljC8Fd1onWK8g/eiZk54869cq E7K08HZl+LbqKAzldG2OK+BqDU7LQjv7DC9fRymXMxtPUqscUekiQ+XI3hHPVH8j8loh 8l2XQF6zSoqZPIAnz+k6Tqs2dxQ89PeSCH40+p2u6peLg/rHBwLNtGk69cchUeQ0exxu paSNqTY0LJgXS7jDZk2wyqPAQLbx5tXp5eLesxaKBZz+sRJHFSCgC55eea3VPYWAAwpi hiBg== X-Gm-Message-State: AFqh2koyQ7InpQomSvPNGyjwhFNceZflBwGUQE/ogyWtMxVwBQUm4FE5 Ql8a63TZbEyPU8KOx624czd2VwkWTSv5b+M8 X-Received: by 2002:adf:ef11:0:b0:2bb:dd87:3485 with SMTP id e17-20020adfef11000000b002bbdd873485mr5463135wro.30.1674034830713; Wed, 18 Jan 2023 01:40:30 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id q4-20020adfdfc4000000b002bc6c180738sm28468752wrn.90.2023.01.18.01.40.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Jan 2023 01:40:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jiaxun Yang , Beraldo Leal , Aurelien Jarno , Wainer dos Santos Moschetta , =?utf-8?q?Philippe_Mathi?= =?utf-8?q?eu-Daud=C3=A9?= , Klaus Jensen , Cleber Rosa Subject: [PATCH 1/2] hw/pci-host/gt64120: Fix PCI I/O config register endianness Date: Wed, 18 Jan 2023 10:40:22 +0100 Message-Id: <20230118094023.49517-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230118094023.49517-1-philmd@linaro.org> References: <20230118094023.49517-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.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, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The MByteSwap bit only affects the data register endianness, not the config register. Map the config register once in the gt64120_realize() handler, and only remap the data register when the mapping is updated. Fixes: 145e2198d7 ("gt64xxx: Endian-swap using PCI_HOST_BRIDGE MemoryRegionOps") Reported-by: Klaus Jensen Signed-off-by: Philippe Mathieu-Daudé Tested-by: Klaus Jensen --- hw/pci-host/gt64120.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/hw/pci-host/gt64120.c b/hw/pci-host/gt64120.c index f226d03420..a88b59f576 100644 --- a/hw/pci-host/gt64120.c +++ b/hw/pci-host/gt64120.c @@ -320,13 +320,6 @@ static void gt64120_isd_mapping(GT64120State *s) static void gt64120_update_pci_cfgdata_mapping(GT64120State *s) { - /* Indexed on MByteSwap bit, see Table 158: PCI_0 Command, Offset: 0xc00 */ - static const MemoryRegionOps *pci_host_conf_ops[] = { - &pci_host_conf_be_ops, &pci_host_conf_le_ops - }; - static const MemoryRegionOps *pci_host_data_ops[] = { - &pci_host_data_be_ops, &pci_host_data_le_ops - }; PCIHostState *phb = PCI_HOST_BRIDGE(s); memory_region_transaction_begin(); @@ -339,22 +332,13 @@ static void gt64120_update_pci_cfgdata_mapping(GT64120State *s) * - Table 16: 32-bit PCI Transaction Endianess * - Table 158: PCI_0 Command, Offset: 0xc00 */ - if (memory_region_is_mapped(&phb->conf_mem)) { - memory_region_del_subregion(&s->ISD_mem, &phb->conf_mem); - object_unparent(OBJECT(&phb->conf_mem)); - } - memory_region_init_io(&phb->conf_mem, OBJECT(phb), - pci_host_conf_ops[s->regs[GT_PCI0_CMD] & 1], - s, "pci-conf-idx", 4); - memory_region_add_subregion_overlap(&s->ISD_mem, GT_PCI0_CFGADDR << 2, - &phb->conf_mem, 1); - if (memory_region_is_mapped(&phb->data_mem)) { memory_region_del_subregion(&s->ISD_mem, &phb->data_mem); object_unparent(OBJECT(&phb->data_mem)); } memory_region_init_io(&phb->data_mem, OBJECT(phb), - pci_host_data_ops[s->regs[GT_PCI0_CMD] & 1], + s->regs[GT_PCI0_CMD] & 1 ? &pci_host_data_le_ops + : &pci_host_data_be_ops, s, "pci-conf-data", 4); memory_region_add_subregion_overlap(&s->ISD_mem, GT_PCI0_CFGDATA << 2, &phb->data_mem, 1); @@ -1207,6 +1191,11 @@ static void gt64120_realize(DeviceState *dev, Error **errp) get_system_io(), PCI_DEVFN(18, 0), TYPE_PCI_BUS); + memory_region_init_io(&phb->conf_mem, OBJECT(phb), &pci_host_conf_le_ops, + s, "pci-conf-idx", 4); + memory_region_add_subregion_overlap(&s->ISD_mem, GT_PCI0_CFGADDR << 2, + &phb->conf_mem, 1); + pci_create_simple(phb->bus, PCI_DEVFN(0, 0), "gt64120_pci"); /* From patchwork Wed Jan 18 09:40:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 643679 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp1655783pvb; Wed, 18 Jan 2023 01:40:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXt/s4+2hftyEVuDEKwmDBEGtqrtUhmkEZC+dqQXruOn5L1xgXbhCTNaYIzo1ZkedxJqvuYK X-Received: by 2002:a05:6214:5093:b0:534:aeae:f37 with SMTP id kk19-20020a056214509300b00534aeae0f37mr11683246qvb.28.1674034855936; Wed, 18 Jan 2023 01:40:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674034855; cv=none; d=google.com; s=arc-20160816; b=lL1z6jKmgzQrWVKqP8oY+l3NqapRFhGNtWIF/2mGOXzJfIOQjqmMHVc7itPhuLyMhX 8qR0U/rDu0VAvX7qso6fpoXrK5OY9oIWzcmiyE3Vy2dCAiwvbP9shYimVoMadSVTlpVa BCzHRXzkTgFtKRxFxqxALe0zFx0SduBiXRFcnpwLqv4Qj/Ngeo0tekrSx5q5VNHyBQWx SCGh12oPKGhGvAerP0UojlbFa/IWXzuTyl+TIbFsdh2d+4sw4JdIB81n5rDZ/2sm+46P Yx59hoFh+cNgWR/sFtDhwQTx6iV4vi0X+elCmPvvwJt3z6w5uAAIKQXeMnHUnQ9r2Obm +Tqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oaRo0GU0CDZsZLHw/XFQ9FNLJtHubTjXB+uAlLi3+pE=; b=OYjG+GRpcnoJYth3tvcMuS2Bol/0GbVpuqs57804AwbU/Y3tp3ufzN3xwB1dZ2H0l5 URXEoWrGPU0Az12q+9CSVdHKkDrVbV2IjkgaQSMASJbpO4hMqmZkWMSih7a0PoicmcN2 Q/tuwwbQ8ZVTvQcqjZ8Kl0Zs+VvtJbfNu9CSbSGIc2XiELyU3WUCoTkjzAUah3+CQpam bk4MJgWMISfOl93cWq5dc4/6Z3pkTCP9AZkTJWnboXdXnqkupKP1MJkZffr2DAo4fSgv ckyFmht7vtI94alqoArzZsSQsO3fs42wK9hC1hYV8ukZOW8j+ceeB6WwN+rSDJhqqPcn vUuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="onxc/iPU"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k22-20020a05620a0b9600b006ff5f75ada7si10570957qkh.161.2023.01.18.01.40.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Jan 2023 01:40:55 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="onxc/iPU"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pI4vx-0000Z3-2G; Wed, 18 Jan 2023 04:40:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pI4vv-0000Yc-BT for qemu-devel@nongnu.org; Wed, 18 Jan 2023 04:40:39 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pI4vt-0003SH-Cp for qemu-devel@nongnu.org; Wed, 18 Jan 2023 04:40:39 -0500 Received: by mail-wm1-x330.google.com with SMTP id m5-20020a05600c4f4500b003db03b2559eso1031960wmq.5 for ; Wed, 18 Jan 2023 01:40:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=oaRo0GU0CDZsZLHw/XFQ9FNLJtHubTjXB+uAlLi3+pE=; b=onxc/iPU8LZMQbgmLMnQRjSw4Hp1QElEn1awQSLfmM78cxJnDi52RzX1oxOzDTmSfC FYvd8kUHEbB58sBdwr+XcgCLGqOQ34MKrJ7rCA28lc4HuX6QEX9Ax2IQ11JGyk6A7Hif J8zPuTqKOH/t6n1lWbNUAtX8+WC8k/+AHCPC2ksb5h96zNqpemY5PBGDEawNrh+BtanQ olPg9gV4IYZh9YRjMCgMiryrw6RuNCEGuQdLiyD16AzXZj9TDIkFswYB6WhwJ/TLReh1 rI66TIpjNTCnu5MoWcwKhXFGx8v+hh9lYZioyBy8nF//qa7xt4DHtXRuJ/CPD6TFpd3n yc6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=oaRo0GU0CDZsZLHw/XFQ9FNLJtHubTjXB+uAlLi3+pE=; b=fqI1fvU8MWnK9f0xAC59Y1yFOWAtJ1aAqWZnhj4ksxo2RGNl27wNgVUupq5/QGz6fS QZL+MEMVoKZ3EJIFoxN284/j2S4NxNdGeGdpsGSoy8WPpoRL9LCiyyfnDp6kYaymC1LZ wN0fXeErYJ04xj0WNj3BGl+PAxJHbP81PuJIPKxEWGfkmqvXqgVkTGTPZXX+kKx9GmcR +EeRUe+u5VRP5Y9VrRR2UiPph4+21AkUQ+Q0uZylQTzbs7mv/KGdYqZY2IORjdfxjcNP 3Iff8i5aGGqp5eHAEO1u5CxSfntXqi3zlmaT9YEOsPuk7or1dYvirXMW4krGy/hB39yU v6KQ== X-Gm-Message-State: AFqh2krosac++yXdlmaCTre1J8g76pmaadvM8G5E89Y2RsWtIBDHf9xW KZ5FUJ1mPhhj41aMNz/k7G+2GbtYBq0GqSLy X-Received: by 2002:a05:600c:502c:b0:3db:30d:deac with SMTP id n44-20020a05600c502c00b003db030ddeacmr5951843wmr.1.1674034835764; Wed, 18 Jan 2023 01:40:35 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id o12-20020a05600c4fcc00b003daff80f16esm1842762wmq.27.2023.01.18.01.40.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Jan 2023 01:40:35 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jiaxun Yang , Beraldo Leal , Aurelien Jarno , Wainer dos Santos Moschetta , =?utf-8?q?Philippe_Mathi?= =?utf-8?q?eu-Daud=C3=A9?= , Klaus Jensen , Cleber Rosa Subject: [PATCH 2/2] tests/avocado: Add test accessing NVMe on big-endian MIPS target Date: Wed, 18 Jan 2023 10:40:23 +0100 Message-Id: <20230118094023.49517-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230118094023.49517-1-philmd@linaro.org> References: <20230118094023.49517-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Add a Linux-boot test accessing PCI NVMe drive on big-endian MIPS: $ avocado --show=app,console run -t device:nvme tests/avocado/ (1/1) tests/avocado/boot_linux_console.py:BootLinuxConsole.test_mips64_malta_I6400_nvme: console: Linux version 6.2.0-rc4 (kbj@butter) (mips64-buildroot-linux-gnu-gcc.br_real (Buildroot 2022.11) 11.3.0, GNU ld (GNU Binutils) 2.38) #6 Tue Jan 17 18:48:25 CET 2023 console: CPU0 revision is: 0001a900 (MIPS I6400) console: FPU revision is: 20f30300 console: MIPS: machine is mti,malta ... console: PCI host bridge to bus 0000:00 console: pci_bus 0000:00: root bus resource [mem 0x10000000-0x17ffffff] console: pci_bus 0000:00: root bus resource [io 0x1000-0x1fffff] console: pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff] console: pci 0000:00:0a.0: [8086:7110] type 00 class 0x060100 console: pci 0000:00:0a.1: [8086:7111] type 00 class 0x010180 console: pci 0000:00:0a.1: reg 0x20: [io 0x0000-0x000f] console: pci 0000:00:0a.1: legacy IDE quirk: reg 0x10: [io 0x01f0-0x01f7] console: pci 0000:00:0a.1: legacy IDE quirk: reg 0x14: [io 0x03f6] console: pci 0000:00:0a.1: legacy IDE quirk: reg 0x18: [io 0x0170-0x0177] console: pci 0000:00:0a.1: legacy IDE quirk: reg 0x1c: [io 0x0376] console: pci 0000:00:0a.2: [8086:7112] type 00 class 0x0c0300 console: pci 0000:00:12.0: [1b36:0010] type 00 class 0x010802 console: pci 0000:00:12.0: reg 0x10: [mem 0x00000000-0x00003fff 64bit] console: pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00 console: pci 0000:00:12.0: BAR 0: assigned [mem 0x10040000-0x10043fff 64bit] console: pci 0000:00:0a.1: BAR 4: assigned [io 0x1080-0x108f] ... console: ata_piix 0000:00:0a.1: enabling device (0000 -> 0001) console: nvme nvme0: pci function 0000:00:12.0 console: nvme 0000:00:12.0: enabling device (0000 -> 0002) console: nvme nvme0: 1/0/0 default/read/poll queues console: nvme nvme0: Ignoring bogus Namespace Identifiers ... console: Run /sbin/init as init process console: EXT4-fs (nvme0n1): re-mounted bf659b11-5a77-4ab5-a337-3d71ced26114. Quota mode: disabled. ... console: Welcome to Buildroot console: buildroot login: root ... console: # reboot ... console: umount: devtmpfs busy - remounted read-only console: EXT4-fs (nvme0n1): re-mounted bf659b11-5a77-4ab5-a337-3d71ced26114. Quota mode: disabled. console: The system is going down NOW! console: Requesting system reboot console: reboot: Restarting system PASS (11.17 s) JOB TIME : 11.91 s Signed-off-by: Philippe Mathieu-Daudé --- tests/avocado/boot_linux_console.py | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py index 8c1d981586..176793482e 100644 --- a/tests/avocado/boot_linux_console.py +++ b/tests/avocado/boot_linux_console.py @@ -12,6 +12,7 @@ import lzma import gzip import shutil +import time from avocado import skip from avocado import skipUnless @@ -269,6 +270,49 @@ def test_mips64el_malta_5KEc_cpio(self): # Wait for VM to shut down gracefully self.vm.wait() + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') + def test_mips64_malta_I6400_nvme(self): + """ + :avocado: tags=arch:mips64 + :avocado: tags=machine:malta + :avocado: tags=endian:big + :avocado: tags=cpu:I6400 + :avocado: tags=device:nvme + """ + kernel_url = ('https://github.com/birkelund/qemu-nvme-boot/' + 'raw/main/mips64/images/vmlinux') + kernel_hash = '665662d7f7b17dc261ffb0e0ff4a1a7da91de948' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + rootfs_url = ('https://github.com/birkelund/qemu-nvme-boot/' + 'raw/main/mips64/images/rootfs.ext2.gz') + rootfs_hash = '66f5ca4ef20ab983ec424c3ed8462bab305bbb73' + rootfs_path_gz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) + rootfs_path = os.path.join(self.workdir, "rootfs.ext2") + archive.gzip_uncompress(rootfs_path_gz, rootfs_path) + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0,115200 ' + + 'root=/dev/nvme0n1 ' + + 'rdinit=/sbin/init noreboot') + self.vm.add_args('-kernel', kernel_path, + '-append', kernel_command_line, + '-drive', + f'file={rootfs_path},format=raw,if=none,id=d0', + '-device', 'nvme,serial=default,drive=d0', + '-nic', 'user,model=pcnet', + '-no-reboot', '-snapshot', '-nodefaults') + self.vm.launch() + wait_for_console_pattern(self, 'Welcome to Buildroot') + time.sleep(0.1) + exec_command(self, 'root') + time.sleep(0.1) + + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'MIPS I6400') + exec_command_and_wait_for_pattern(self, 'reboot', + 'reboot: Restarting system') + def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash): kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash) kernel_path = self.workdir + "kernel"