From nobody Thu May 9 08:44:39 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1659141700; cv=none; d=zohomail.com; s=zohoarc; b=LOMvgKxIHk2Jz/KDZx05gGUQ1pEtrZBsyKVBKcpeoL6qcB/aZ3gTGK/uQjFooGGgDEz1efHHoZdax5X7a3FHmgFk4M6FOkAlp/w0zOcNOCRivirCrCui5UMpD4ULnx8cJsPcp++5kpJNgOgyPp4qMmdV5Qz5OUcp+wBiPHmFH/E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659141700; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YKnWKxobxWr0eoYl/6FV/vOfO1g5odZSiiZMd2jnFpE=; b=lzTZmIjKSE3ElzG9LE9aMjdPccBT7o74yGBI0n/7r0TdH6lkSGqB8q0eKTppLyrQy7QEjhRTzZ8UZx/Wvmpzp5FLGmZ8Pve06BuilhP/HWmccLwKAny0/8rfMt6fvL9yDNmctEMb3HuSXACQ2OytRDZKGEEYzxzaQyrbNSQ8urg= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1659141700795805.5043975510149; Fri, 29 Jul 2022 17:41:40 -0700 (PDT) Received: from localhost ([::1]:47476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHaXy-0004Ns-SJ for importer@patchew.org; Fri, 29 Jul 2022 20:41:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHaUb-0002Xa-TK for qemu-devel@nongnu.org; Fri, 29 Jul 2022 20:38:09 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:47041) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oHaUU-0003Hw-47 for qemu-devel@nongnu.org; Fri, 29 Jul 2022 20:38:09 -0400 Received: by mail-pf1-x42d.google.com with SMTP id c3so5912778pfb.13 for ; Fri, 29 Jul 2022 17:38:01 -0700 (PDT) Received: from stoup.. ([2602:ae:1549:801:a427:660:88d4:8559]) by smtp.gmail.com with ESMTPSA id a13-20020a1709027e4d00b0016dbc169316sm4228345pln.187.2022.07.29.17.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jul 2022 17:37:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YKnWKxobxWr0eoYl/6FV/vOfO1g5odZSiiZMd2jnFpE=; b=dWYYGKq9+UxDjRpTsCP2HMazqT1i+KHyMydoCRGzqNN32el09GbBrglBdGxs0D/Q2S /Tt1oXvKEjUSTK6uEM2T3w61Vb4sHegnD0WoQ86OwDZNze6TTT9GjMJNcBLipNR2EYmT sHdpWLknBuj2ge+21x52NWHxXrkB/ua0pN82rBvcXO1uoRrzWPTXaRVbmfh00cF6izMU Hw/ufe6PNfWgJ71WbJAaxvvR1fvmf/exZZ9mrP9iXqqZ+5gnGG0IvrF2DB2RsxjBZ35M AmHkWSCr9e9YbCcerC+PUKVhlyU++hk/Uwkz2GGqh6rPzarz1psYHKpfXhjgmEhPWB53 iYLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YKnWKxobxWr0eoYl/6FV/vOfO1g5odZSiiZMd2jnFpE=; b=QXPaIOE3QJHgWicfrgzXykfomc/ezUaFb1swLyZt8Vctr/Qx8hPBTzAY5JOqWNXUZM 8Gny+VF/MpGqhsvjSUPh3bH+oHwE5lfwn88fqfVRKOO9DIXgZGGDXUPAwA0GrjOpPKeZ CfsYRbIhf/p96FhkvGlOql4kx0vhAxvGiA5l58vYwRc2EMFWtgq9Lotn1LsodYMksUrK O+cVO0b1ZuVS7ZEDQdp5T3HQ5R2trUO66EF791TDD+2wEBxX6CZKeBWQkykPnV+XwzVk ez8nMWRYcr2JMgw5fHKwAGRMdiLt7Ohy9cYFx+9iFWDq3JMzRCnGMR2LxXFyNt/Nw+nx lJfA== X-Gm-Message-State: AJIora87v/8JD4efgxjO/0MldrnGB4xRdgRf69V4EAh74gKiH45iQieo JN7t6ErAT/vzlmwl6Wet/621XH9GyKeSNw== X-Google-Smtp-Source: AGRyM1tfuDP5ymbIgUyhy0DTharfDLUlWsGnUt4cvstt5p27mr/LpYsi8VOnAj0lkm6F9pSDGarunA== X-Received: by 2002:a63:a1d:0:b0:41b:4483:35d1 with SMTP id 29-20020a630a1d000000b0041b448335d1mr4823663pgk.441.1659141480112; Fri, 29 Jul 2022 17:38:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Xiaojuan Yang Subject: [PULL 1/2] hw/loongarch: Rename file 'loongson3.XXX' to 'virt.XXX' Date: Fri, 29 Jul 2022 17:37:54 -0700 Message-Id: <20220730003755.54019-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220730003755.54019-1-richard.henderson@linaro.org> References: <20220730003755.54019-1-richard.henderson@linaro.org> 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::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1659141703120100001 Content-Type: text/plain; charset="utf-8" From: Xiaojuan Yang 1. Rename 'loongson3.c' to 'virt.c' and change the meson.build file. 2. Rename 'loongson3.rst' to 'virt.rst'. Signed-off-by: Xiaojuan Yang Message-Id: <20220729073018.27037-2-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson --- hw/loongarch/{loongson3.c =3D> virt.c} | 0 MAINTAINERS | 2 +- hw/loongarch/meson.build | 2 +- target/loongarch/README | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename hw/loongarch/{loongson3.c =3D> virt.c} (100%) diff --git a/hw/loongarch/loongson3.c b/hw/loongarch/virt.c similarity index 100% rename from hw/loongarch/loongson3.c rename to hw/loongarch/virt.c diff --git a/MAINTAINERS b/MAINTAINERS index 6af9cd985c..5ce4227ff6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1129,7 +1129,7 @@ Virt M: Xiaojuan Yang M: Song Gao S: Maintained -F: docs/system/loongarch/loongson3.rst +F: docs/system/loongarch/virt.rst F: configs/targets/loongarch64-softmmu.mak F: configs/devices/loongarch64-softmmu/default.mak F: hw/loongarch/ diff --git a/hw/loongarch/meson.build b/hw/loongarch/meson.build index 6a2a1b18e5..c0421502ab 100644 --- a/hw/loongarch/meson.build +++ b/hw/loongarch/meson.build @@ -2,7 +2,7 @@ loongarch_ss =3D ss.source_set() loongarch_ss.add(files( 'fw_cfg.c', )) -loongarch_ss.add(when: 'CONFIG_LOONGARCH_VIRT', if_true: [files('loongson3= .c'), fdt]) +loongarch_ss.add(when: 'CONFIG_LOONGARCH_VIRT', if_true: [files('virt.c'),= fdt]) loongarch_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-build.c')) =20 hw_arch +=3D {'loongarch': loongarch_ss} diff --git a/target/loongarch/README b/target/loongarch/README index 9f5edd10c8..1823375d04 100644 --- a/target/loongarch/README +++ b/target/loongarch/README @@ -15,7 +15,7 @@ 3A5000 support multiple interrupt cascading while here we just emulate t= he extioi interrupt cascading. LS7A1000 host bridge support multiple devices, such as sata, = gmac, uart, rtc and so on. But we just realize the rtc. Others use the qemu common devic= es. It does not affect - the general use. We also introduced the emulation of devices at docs/sys= tem/loongarch/loongson3.rst. + the general use. We also introduced the emulation of devices at docs/sys= tem/loongarch/virt.rst. =20 This version only supports running binary files in ELF format, and does = not depend on BIOS and kernel file. You can compile the test program with 'make & make check-tcg' and run th= e test case with the following command: --=20 2.34.1 From nobody Thu May 9 08:44:39 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1659141708; cv=none; d=zohomail.com; s=zohoarc; b=Xtci2yjUfROmDAl3s/P2hgiMOtd7OJTSCla2H6HRo0BNk8uTux9vvQeQDytvguMBy+Eo7KipfZGiI6g9CyFWn+IM3W5SNgqRHw89tRRrxFSNrRo8ZsGcaTiY0z24dFJutsoZw5ZE6grnqPruk9QhvgFroxh1hnDPphWY5aVgItk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659141708; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rm4ugmxA5FsXgr/PT+fUDmlDIQy3A6URE0xO5sZ8pvw=; b=FHJwGzivk8vFzEAyb06CVO+IRf6j59S9dfYEs+mgEZgNLGDbpI4HQ5f50swTL2xGNBTav5fFQwsAiWLHwGwkuHaiRNrXzhFHrT775jguCWJ5RmszQguChxAqZo+lviXxqW4OlzEKv6mu2d8X2eiA+AQjQ7f5/bru38VzIi1yz+I= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165914170797935.08132890278034; Fri, 29 Jul 2022 17:41:47 -0700 (PDT) Received: from localhost ([::1]:47576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHaY5-0004Rk-L4 for importer@patchew.org; Fri, 29 Jul 2022 20:41:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHaUc-0002Xi-R5 for qemu-devel@nongnu.org; Fri, 29 Jul 2022 20:38:10 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:42782) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oHaUV-0003I0-BF for qemu-devel@nongnu.org; Fri, 29 Jul 2022 20:38:10 -0400 Received: by mail-pl1-x62e.google.com with SMTP id b22so5911741plz.9 for ; Fri, 29 Jul 2022 17:38:02 -0700 (PDT) Received: from stoup.. ([2602:ae:1549:801:a427:660:88d4:8559]) by smtp.gmail.com with ESMTPSA id a13-20020a1709027e4d00b0016dbc169316sm4228345pln.187.2022.07.29.17.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jul 2022 17:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rm4ugmxA5FsXgr/PT+fUDmlDIQy3A6URE0xO5sZ8pvw=; b=fLHyQ0xf+D/a0eesjSRysWYv3DM1utwbS5lCi00J84qDvhub54Dr+IKRL7a0YGB3/k EASvYWEKHIk/ixofmrpwznztDRo2766NYljZMRPaRvfvRrNPTGz3N6MiwW1Li6XgslFG DsOs/PbcvLESaG6gteqIooMd575eDcMfINOJLvOT/WBdIkJCKHYdrjvJf127JZTZpAYA rVkdPYqpS5HLe9I7+6WcFn7Pp32IgC/4eC75rQDPUp6cFGUW9XxAKDTaTnMOxTv3/yfi nr3Qo7aMCfsAvg20IHN1IdSFbPorbkl+tfF9LFufrLW77v0dmPxkomGsPMQybj86MAeS kYuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rm4ugmxA5FsXgr/PT+fUDmlDIQy3A6URE0xO5sZ8pvw=; b=I9O67QUSyz7VjNxiwy3kRo7OcS6lH+l5FhdfI++LRiKtS6q0XwHH22io9gUveS/lrc ZhEVd18t+u8xH4/RUdgFhE698aaB8rJwRYMI2dT/eRYhmqObIrPzO5izWEBrw8pp6r63 DxUvzymKYAdi9UgkZ9RYcvJ87zWdhy4fwByPhD/ALCwsN4G/S0Jn2IApJW2XrUiuWiRy vD1ddBI+CtemFo8Dn/+smvD2qflFeUqRQ+kWd9R6Ufjjzv8UCeXQhbp8AUUHKeFpjM1R oZuLf0EWA7v7q2uQSVqbMqpHvtAOgDIwLVsZTRaYBTU9nsQYtvsHvbN7/kdNfaDczjVX beLA== X-Gm-Message-State: ACgBeo2n5rfVWKpz9dNNFU2UeySwkM1KY/FNDzg20EbgGy7Ni2J2lisS vIfCF2TcTVqkZ1W4PUwUrC7MkBQGb0DL2A== X-Google-Smtp-Source: AA6agR5j4nYu0zqwaRSntJo8n98xyyZc/Q6rSicpduIioviRYA5tJf6+UlTRkQoafKa/Sj7krkbrZQ== X-Received: by 2002:a17:902:d4c2:b0:16d:c317:ee9d with SMTP id o2-20020a170902d4c200b0016dc317ee9dmr5957816plg.25.1659141481309; Fri, 29 Jul 2022 17:38:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Xiaojuan Yang Subject: [PULL 2/2] hw/loongarch: Change macro name 'LS7A_XXX' to 'VIRT_XXX' Date: Fri, 29 Jul 2022 17:37:55 -0700 Message-Id: <20220730003755.54019-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220730003755.54019-1-richard.henderson@linaro.org> References: <20220730003755.54019-1-richard.henderson@linaro.org> 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::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1659141708838100001 Content-Type: text/plain; charset="utf-8" From: Xiaojuan Yang Change macro name 'LS7A_XXX' to 'VIRT_XXX', as the loongarch virt machinue use the GPEX bridge instead of LS7A bridge. So the macro name should keep consistency. Signed-off-by: Xiaojuan Yang Message-Id: <20220729073018.27037-3-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson --- include/hw/loongarch/virt.h | 8 +++--- include/hw/pci-host/ls7a.h | 43 +++++++++++++--------------- hw/loongarch/acpi-build.c | 18 ++++++------ hw/loongarch/virt.c | 56 ++++++++++++++++++------------------- 4 files changed, 61 insertions(+), 64 deletions(-) diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h index f4f24df428..92b84de1c5 100644 --- a/include/hw/loongarch/virt.h +++ b/include/hw/loongarch/virt.h @@ -15,8 +15,8 @@ =20 #define LOONGARCH_MAX_VCPUS 4 =20 -#define LOONGARCH_ISA_IO_BASE 0x18000000UL -#define LOONGARCH_ISA_IO_SIZE 0x0004000 +#define VIRT_ISA_IO_BASE 0x18000000UL +#define VIRT_ISA_IO_SIZE 0x0004000 #define VIRT_FWCFG_BASE 0x1e020000UL #define VIRT_BIOS_BASE 0x1c000000UL #define VIRT_BIOS_SIZE (4 * MiB) @@ -28,8 +28,8 @@ #define VIRT_GED_MEM_ADDR (VIRT_GED_EVT_ADDR + ACPI_GED_EVT_SEL_LEN) #define VIRT_GED_REG_ADDR (VIRT_GED_MEM_ADDR + MEMORY_HOTPLUG_IO_LEN) =20 -#define LA_FDT_BASE 0x1c400000 -#define LA_FDT_SIZE 0x100000 +#define VIRT_FDT_BASE 0x1c400000 +#define VIRT_FDT_SIZE 0x100000 =20 struct LoongArchMachineState { /*< private >*/ diff --git a/include/hw/pci-host/ls7a.h b/include/hw/pci-host/ls7a.h index 0fdc86b973..cdde0af1f8 100644 --- a/include/hw/pci-host/ls7a.h +++ b/include/hw/pci-host/ls7a.h @@ -15,34 +15,31 @@ #include "qemu/range.h" #include "qom/object.h" =20 -#define LS7A_PCI_MEM_BASE 0x40000000UL -#define LS7A_PCI_MEM_SIZE 0x40000000UL -#define LS7A_PCI_IO_OFFSET 0x4000 -#define LS_PCIECFG_BASE 0x20000000 -#define LS_PCIECFG_SIZE 0x08000000 -#define LS7A_PCI_IO_BASE 0x18004000UL -#define LS7A_PCI_IO_SIZE 0xC000 +#define VIRT_PCI_MEM_BASE 0x40000000UL +#define VIRT_PCI_MEM_SIZE 0x40000000UL +#define VIRT_PCI_IO_OFFSET 0x4000 +#define VIRT_PCI_CFG_BASE 0x20000000 +#define VIRT_PCI_CFG_SIZE 0x08000000 +#define VIRT_PCI_IO_BASE 0x18004000UL +#define VIRT_PCI_IO_SIZE 0xC000 =20 -#define LS7A_PCI_MEM_BASE 0x40000000UL -#define LS7A_PCI_MEM_SIZE 0x40000000UL - -#define LS7A_PCH_REG_BASE 0x10000000UL -#define LS7A_IOAPIC_REG_BASE (LS7A_PCH_REG_BASE) -#define LS7A_PCH_MSI_ADDR_LOW 0x2FF00000UL +#define VIRT_PCH_REG_BASE 0x10000000UL +#define VIRT_IOAPIC_REG_BASE (VIRT_PCH_REG_BASE) +#define VIRT_PCH_MSI_ADDR_LOW 0x2FF00000UL =20 /* * According to the kernel pch irq start from 64 offset * 0 ~ 16 irqs used for non-pci device while 16 ~ 64 irqs * used for pci device. */ -#define PCH_PIC_IRQ_OFFSET 64 -#define LS7A_DEVICE_IRQS 16 -#define LS7A_PCI_IRQS 48 -#define LS7A_UART_IRQ (PCH_PIC_IRQ_OFFSET + 2) -#define LS7A_UART_BASE 0x1fe001e0 -#define LS7A_RTC_IRQ (PCH_PIC_IRQ_OFFSET + 3) -#define LS7A_MISC_REG_BASE (LS7A_PCH_REG_BASE + 0x00080000) -#define LS7A_RTC_REG_BASE (LS7A_MISC_REG_BASE + 0x00050100) -#define LS7A_RTC_LEN 0x100 -#define LS7A_SCI_IRQ (PCH_PIC_IRQ_OFFSET + 4) +#define PCH_PIC_IRQ_OFFSET 64 +#define VIRT_DEVICE_IRQS 16 +#define VIRT_PCI_IRQS 48 +#define VIRT_UART_IRQ (PCH_PIC_IRQ_OFFSET + 2) +#define VIRT_UART_BASE 0x1fe001e0 +#define VIRT_RTC_IRQ (PCH_PIC_IRQ_OFFSET + 3) +#define VIRT_MISC_REG_BASE (VIRT_PCH_REG_BASE + 0x00080000) +#define VIRT_RTC_REG_BASE (VIRT_MISC_REG_BASE + 0x00050100) +#define VIRT_RTC_LEN 0x100 +#define VIRT_SCI_IRQ (PCH_PIC_IRQ_OFFSET + 4) #endif diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c index b95b83b079..4b4529a3fb 100644 --- a/hw/loongarch/acpi-build.c +++ b/hw/loongarch/acpi-build.c @@ -135,7 +135,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, Loon= gArchMachineState *lams) build_append_int_noprefix(table_data, 21, 1); /* Type */ build_append_int_noprefix(table_data, 19, 1); /* Length */ build_append_int_noprefix(table_data, 1, 1); /* Version */ - build_append_int_noprefix(table_data, LS7A_PCH_MSI_ADDR_LOW, 8);/* Add= ress */ + build_append_int_noprefix(table_data, VIRT_PCH_MSI_ADDR_LOW, 8);/* Add= ress */ build_append_int_noprefix(table_data, 0x40, 4); /* Start */ build_append_int_noprefix(table_data, 0xc0, 4); /* Count */ =20 @@ -143,7 +143,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, Loon= gArchMachineState *lams) build_append_int_noprefix(table_data, 22, 1); /* Type */ build_append_int_noprefix(table_data, 17, 1); /* Length */ build_append_int_noprefix(table_data, 1, 1); /* Version */ - build_append_int_noprefix(table_data, LS7A_PCH_REG_BASE, 8);/* Address= */ + build_append_int_noprefix(table_data, VIRT_PCH_REG_BASE, 8);/* Address= */ build_append_int_noprefix(table_data, 0x1000, 2); /* Size */ build_append_int_noprefix(table_data, 0, 2); /* Id */ build_append_int_noprefix(table_data, 0x40, 2); /* Base */ @@ -307,7 +307,7 @@ static void build_uart_device_aml(Aml *table) Aml *dev; Aml *crs; Aml *pkg0, *pkg1, *pkg2; - uint32_t uart_irq =3D LS7A_UART_IRQ; + uint32_t uart_irq =3D VIRT_UART_IRQ; =20 Aml *scope =3D aml_scope("_SB"); dev =3D aml_device("COMA"); @@ -367,7 +367,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, Mach= ineState *machine) if (lams->acpi_ged) { build_ged_aml(dsdt, "\\_SB."GED_DEVICE, HOTPLUG_HANDLER(lams->acpi_ged), - LS7A_SCI_IRQ - PCH_PIC_IRQ_OFFSET, AML_SYSTEM_MEMORY, + VIRT_SCI_IRQ - PCH_PIC_IRQ_OFFSET, AML_SYSTEM_MEMORY, VIRT_GED_EVT_ADDR); } =20 @@ -385,9 +385,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, Mach= ineState *machine) aml_append(crs, aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, AML_CACHEABLE, AML_READ_WRITE, - 0, LS7A_PCI_MEM_BASE, - LS7A_PCI_MEM_BASE + LS7A_PCI_MEM_SIZE - 1, - 0, LS7A_PCI_MEM_BASE)); + 0, VIRT_PCI_MEM_BASE, + VIRT_PCI_MEM_BASE + VIRT_PCI_MEM_SIZE - 1, + 0, VIRT_PCI_MEM_BASE)); aml_append(scope, aml_name_decl("_CRS", crs)); aml_append(dsdt, scope); =20 @@ -462,8 +462,8 @@ static void acpi_build(AcpiBuildTables *tables, Machine= State *machine) acpi_add_table(table_offsets, tables_blob); { AcpiMcfgInfo mcfg =3D { - .base =3D cpu_to_le64(LS_PCIECFG_BASE), - .size =3D cpu_to_le64(LS_PCIECFG_SIZE), + .base =3D cpu_to_le64(VIRT_PCI_CFG_BASE), + .size =3D cpu_to_le64(VIRT_PCI_CFG_SIZE), }; build_mcfg(tables_blob, tables->linker, &mcfg, lams->oem_id, lams->oem_table_id); diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index a08dc9d299..5cc0b05538 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -126,12 +126,12 @@ static void fdt_add_fw_cfg_node(const LoongArchMachin= eState *lams) static void fdt_add_pcie_node(const LoongArchMachineState *lams) { char *nodename; - hwaddr base_mmio =3D LS7A_PCI_MEM_BASE; - hwaddr size_mmio =3D LS7A_PCI_MEM_SIZE; - hwaddr base_pio =3D LS7A_PCI_IO_BASE; - hwaddr size_pio =3D LS7A_PCI_IO_SIZE; - hwaddr base_pcie =3D LS_PCIECFG_BASE; - hwaddr size_pcie =3D LS_PCIECFG_SIZE; + hwaddr base_mmio =3D VIRT_PCI_MEM_BASE; + hwaddr size_mmio =3D VIRT_PCI_MEM_SIZE; + hwaddr base_pio =3D VIRT_PCI_IO_BASE; + hwaddr size_pio =3D VIRT_PCI_IO_SIZE; + hwaddr base_pcie =3D VIRT_PCI_CFG_BASE; + hwaddr size_pcie =3D VIRT_PCI_CFG_SIZE; hwaddr base =3D base_pcie; =20 const MachineState *ms =3D MACHINE(lams); @@ -145,12 +145,12 @@ static void fdt_add_pcie_node(const LoongArchMachineS= tate *lams) qemu_fdt_setprop_cell(ms->fdt, nodename, "#size-cells", 2); qemu_fdt_setprop_cell(ms->fdt, nodename, "linux,pci-domain", 0); qemu_fdt_setprop_cells(ms->fdt, nodename, "bus-range", 0, - PCIE_MMCFG_BUS(LS_PCIECFG_SIZE - 1)); + PCIE_MMCFG_BUS(VIRT_PCI_CFG_SIZE - 1)); qemu_fdt_setprop(ms->fdt, nodename, "dma-coherent", NULL, 0); qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", 2, base_pcie, 2, size_pcie); qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "ranges", - 1, FDT_PCI_RANGE_IOPORT, 2, LS7A_PCI_IO_O= FFSET, + 1, FDT_PCI_RANGE_IOPORT, 2, VIRT_PCI_IO_O= FFSET, 2, base_pio, 2, size_pio, 1, FDT_PCI_RANGE_MMIO, 2, base_mmio, 2, base_mmio, 2, size_mmio); @@ -313,7 +313,7 @@ static DeviceState *create_acpi_ged(DeviceState *pch_pi= c, LoongArchMachineState sysbus_mmio_map(SYS_BUS_DEVICE(dev), 2, VIRT_GED_REG_ADDR); =20 sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, - qdev_get_gpio_in(pch_pic, LS7A_SCI_IRQ - PCH_PIC_IR= Q_OFFSET)); + qdev_get_gpio_in(pch_pic, VIRT_SCI_IRQ - PCH_PIC_IR= Q_OFFSET)); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); return dev; } @@ -336,24 +336,24 @@ static void loongarch_devices_init(DeviceState *pch_p= ic, LoongArchMachineState * ecam_alias =3D g_new0(MemoryRegion, 1); ecam_reg =3D sysbus_mmio_get_region(d, 0); memory_region_init_alias(ecam_alias, OBJECT(gpex_dev), "pcie-ecam", - ecam_reg, 0, LS_PCIECFG_SIZE); - memory_region_add_subregion(get_system_memory(), LS_PCIECFG_BASE, + ecam_reg, 0, VIRT_PCI_CFG_SIZE); + memory_region_add_subregion(get_system_memory(), VIRT_PCI_CFG_BASE, ecam_alias); =20 /* Map PCI mem space */ mmio_alias =3D g_new0(MemoryRegion, 1); mmio_reg =3D sysbus_mmio_get_region(d, 1); memory_region_init_alias(mmio_alias, OBJECT(gpex_dev), "pcie-mmio", - mmio_reg, LS7A_PCI_MEM_BASE, LS7A_PCI_MEM_SIZ= E); - memory_region_add_subregion(get_system_memory(), LS7A_PCI_MEM_BASE, + mmio_reg, VIRT_PCI_MEM_BASE, VIRT_PCI_MEM_SIZ= E); + memory_region_add_subregion(get_system_memory(), VIRT_PCI_MEM_BASE, mmio_alias); =20 /* Map PCI IO port space. */ pio_alias =3D g_new0(MemoryRegion, 1); pio_reg =3D sysbus_mmio_get_region(d, 2); memory_region_init_alias(pio_alias, OBJECT(gpex_dev), "pcie-io", pio_r= eg, - LS7A_PCI_IO_OFFSET, LS7A_PCI_IO_SIZE); - memory_region_add_subregion(get_system_memory(), LS7A_PCI_IO_BASE, + VIRT_PCI_IO_OFFSET, VIRT_PCI_IO_SIZE); + memory_region_add_subregion(get_system_memory(), VIRT_PCI_IO_BASE, pio_alias); =20 for (i =3D 0; i < GPEX_NUM_IRQS; i++) { @@ -362,9 +362,9 @@ static void loongarch_devices_init(DeviceState *pch_pic= , LoongArchMachineState * gpex_set_irq_num(GPEX_HOST(gpex_dev), i, 16 + i); } =20 - serial_mm_init(get_system_memory(), LS7A_UART_BASE, 0, + serial_mm_init(get_system_memory(), VIRT_UART_BASE, 0, qdev_get_gpio_in(pch_pic, - LS7A_UART_IRQ - PCH_PIC_IRQ_OFFSET), + VIRT_UART_IRQ - PCH_PIC_IRQ_OFFSET), 115200, serial_hd(0), DEVICE_LITTLE_ENDIAN); =20 /* Network init */ @@ -386,9 +386,9 @@ static void loongarch_devices_init(DeviceState *pch_pic= , LoongArchMachineState * * Create some unimplemented devices to emulate this. */ create_unimplemented_device("pci-dma-cfg", 0x1001041c, 0x4); - sysbus_create_simple("ls7a_rtc", LS7A_RTC_REG_BASE, + sysbus_create_simple("ls7a_rtc", VIRT_RTC_REG_BASE, qdev_get_gpio_in(pch_pic, - LS7A_RTC_IRQ - PCH_PIC_IRQ_OFFSET)); + VIRT_RTC_IRQ - PCH_PIC_IRQ_OFFSET)); =20 pm_mem =3D g_new(MemoryRegion, 1); memory_region_init_io(pm_mem, NULL, &loongarch_virt_pm_ops, @@ -472,13 +472,13 @@ static void loongarch_irq_init(LoongArchMachineState = *lams) pch_pic =3D qdev_new(TYPE_LOONGARCH_PCH_PIC); d =3D SYS_BUS_DEVICE(pch_pic); sysbus_realize_and_unref(d, &error_fatal); - memory_region_add_subregion(get_system_memory(), LS7A_IOAPIC_REG_BASE, + memory_region_add_subregion(get_system_memory(), VIRT_IOAPIC_REG_BASE, sysbus_mmio_get_region(d, 0)); memory_region_add_subregion(get_system_memory(), - LS7A_IOAPIC_REG_BASE + PCH_PIC_ROUTE_ENTRY_OFF= SET, + VIRT_IOAPIC_REG_BASE + PCH_PIC_ROUTE_ENTRY_OFF= SET, sysbus_mmio_get_region(d, 1)); memory_region_add_subregion(get_system_memory(), - LS7A_IOAPIC_REG_BASE + PCH_PIC_INT_STATUS_LO, + VIRT_IOAPIC_REG_BASE + PCH_PIC_INT_STATUS_LO, sysbus_mmio_get_region(d, 2)); =20 /* Connect 64 pch_pic irqs to extioi */ @@ -490,7 +490,7 @@ static void loongarch_irq_init(LoongArchMachineState *l= ams) qdev_prop_set_uint32(pch_msi, "msi_irq_base", PCH_MSI_IRQ_START); d =3D SYS_BUS_DEVICE(pch_msi); sysbus_realize_and_unref(d, &error_fatal); - sysbus_mmio_map(d, 0, LS7A_PCH_MSI_ADDR_LOW); + sysbus_mmio_map(d, 0, VIRT_PCH_MSI_ADDR_LOW); for (i =3D 0; i < PCH_MSI_IRQ_NUM; i++) { /* Connect 192 pch_msi irqs to extioi */ qdev_connect_gpio_out(DEVICE(d), i, @@ -666,8 +666,8 @@ static void loongarch_init(MachineState *machine) memmap_add_entry(0x90000000, highram_size, 1); /* Add isa io region */ memory_region_init_alias(&lams->isa_io, NULL, "isa-io", - get_system_io(), 0, LOONGARCH_ISA_IO_SIZE); - memory_region_add_subregion(address_space_mem, LOONGARCH_ISA_IO_BASE, + get_system_io(), 0, VIRT_ISA_IO_SIZE); + memory_region_add_subregion(address_space_mem, VIRT_ISA_IO_BASE, &lams->isa_io); /* load the BIOS image. */ loongarch_firmware_init(lams); @@ -706,9 +706,9 @@ static void loongarch_init(MachineState *machine) =20 /* load fdt */ MemoryRegion *fdt_rom =3D g_new(MemoryRegion, 1); - memory_region_init_rom(fdt_rom, NULL, "fdt", LA_FDT_SIZE, &error_fatal= ); - memory_region_add_subregion(get_system_memory(), LA_FDT_BASE, fdt_rom); - rom_add_blob_fixed("fdt", machine->fdt, lams->fdt_size, LA_FDT_BASE); + memory_region_init_rom(fdt_rom, NULL, "fdt", VIRT_FDT_SIZE, &error_fat= al); + memory_region_add_subregion(get_system_memory(), VIRT_FDT_BASE, fdt_ro= m); + rom_add_blob_fixed("fdt", machine->fdt, lams->fdt_size, VIRT_FDT_BASE); } =20 bool loongarch_is_acpi_enabled(LoongArchMachineState *lams) --=20 2.34.1