From patchwork Sat Jul 30 00:37:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 594516 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp1776006maz; Fri, 29 Jul 2022 17:41:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uW0wqPdTpyQgKTrDLxfOVDFIPRYLtvlZ+4/h2ag94hQuJCUTatV51IeOSvq59uWufdl7C8 X-Received: by 2002:a05:620a:24cf:b0:6b6:8102:25a0 with SMTP id m15-20020a05620a24cf00b006b6810225a0mr4553857qkn.314.1659141665599; Fri, 29 Jul 2022 17:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659141665; cv=none; d=google.com; s=arc-20160816; b=oJ5MVvABO46QhQsgKuMUQXN7gowIT9e6XdyDsUD7wA2oBIS2ZAOAfsGRHPjNXQquAy 09d6hn/Frn0XaovDVj/g/KemkQcXHQOSm7Wlhc502t4GD4sQlLHi2GSauufhvKPdbfJi dXXMbVNYL6mXgdYTN8k+9pwPGQiWdJikp0SU1t0c0he+A/Y35ToljxjtMNgrps4HYafk IZPtovYee7Az4diSJ1/6vC50ICnPr6w5BRyQa14/QUcj2GWPeIzjScRhWXlPsYlZeh4O hRcaU0RQJSmXl3OThf4Ha0PnaOfNos9ytCZExXcIC6fLCC3OogfX3Nb4jdNr4xPT5rqm haPQ== 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=YKnWKxobxWr0eoYl/6FV/vOfO1g5odZSiiZMd2jnFpE=; b=VSCpMSho9+07HWyLW5bKM4VjaoHUb/ySN+CcPgktroZsjlVqQr5U6pqAOK4a6MYyRi g0XfDD13xeC/OACL9mWDjWaJA3NFgMwFrc4dXWS7wUhi9ShpEI6TxaI/I6C0HAa46SjO MCxLHhMBZxGc47OrvEkgw4ZCQVBmCOK55ZdG63sjzqWKQmDy9UVRDabZ6w6FVNR8h6vC zTcQgDZpVwMo6KtmzGmA3uVJpI28O4tvKni1XQotRtsfLWwibHVqa6JlP5jmMUlD50GA CD7c3FaShYXxDk5tv4jBDRS3ZMsa5c+IyohA81EWqASfZASf1Rz9WeJg4riPsxFAaL/z NcmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dWYYGKq9; 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 u5-20020a0562141c0500b004747aae539bsi3301288qvc.242.2022.07.29.17.41.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Jul 2022 17:41:05 -0700 (PDT) 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=dWYYGKq9; 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]:45018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHaXQ-0002Y8-M9 for patch@linaro.org; Fri, 29 Jul 2022 20:41:04 -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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 => 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 => 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 = 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')) hw_arch += {'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 the 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 devices. It does not affect - the general use. We also introduced the emulation of devices at docs/system/loongarch/loongson3.rst. + the general use. We also introduced the emulation of devices at docs/system/loongarch/virt.rst. 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 the test case with the following command: From patchwork Sat Jul 30 00:37:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 594517 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp1776016maz; Fri, 29 Jul 2022 17:41:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tKKoX70R3G4MyvcaMrgCUDvI2DSwFOPlIUAvuenwOHGNud7MaXeMLstbe2CgqMJnmhOMYO X-Received: by 2002:ac8:5e49:0:b0:31f:1bfe:b906 with SMTP id i9-20020ac85e49000000b0031f1bfeb906mr5761491qtx.18.1659141667304; Fri, 29 Jul 2022 17:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659141667; cv=none; d=google.com; s=arc-20160816; b=TwVXP2g7WFoJ0HkmcOjiwCKv+oa0YzxJ85ikfAWptSICqhwHFx3fL5ju2/POZsnTmY Lo5ceVFJn5gvIV20V/fS0TwabOhcRfV8C4lCA30htd87dT4IUCRm+XGfUzGYNOsaklb7 LrZiw1nl+3XDF9Qmc/nqYjVo7qUAFGd1sjytnfgy/WngWBeoX5RZc2x3hoF50CFgd32X 6B1xUVSsuH+SzffKYrNaYpM94BUukBVxuWJfjbJOiTGMcF1MuH0iJW12rLlWUud97Pu1 w65zz7IpWm6MJfX7BQ/NSaHYncDmRo8q5OeQdUN+ybVYk1ijPpjvZDN4SYqf49J7/3Yd IG0g== 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=rm4ugmxA5FsXgr/PT+fUDmlDIQy3A6URE0xO5sZ8pvw=; b=hnafoU6mZPzFXgBCvqMsgGEWBbJi/uRbkV/Q59Kg343K0iSNDrNsdliP0/aD2wseMv 2a/W0jEJAyu+3BPJOCpyZs+kWBUZc2SRJ6sAeRVw8N+dVr57VPEZTfBw4nNNhShFS958 551AaK6IV4llHsLrfitE90u/q2xwuACjRgpEM6/iJM283IHS1AYKAClyqPXN6tX0wWHA 7QetZW99jNH0XYeZj0JNeA0WgTJpQo+r14nELyxpLhjyxfLC+YUM7wH73J3e+UbkC4jQ nCZ90bTKof8fkM3FUT8tv82ElABifOrhv7lFz1zjpW150r3s6cFP1GCrqqFscJ72+uPg 6iuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fLHyQ0xf; 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 f15-20020a37ad0f000000b006b5cdea9751si2891438qkm.424.2022.07.29.17.41.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Jul 2022 17:41:07 -0700 (PDT) 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=fLHyQ0xf; 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]:45028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHaXS-0002Yj-TG for patch@linaro.org; Fri, 29 Jul 2022 20:41:06 -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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 @@ #define LOONGARCH_MAX_VCPUS 4 -#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) -#define LA_FDT_BASE 0x1c400000 -#define LA_FDT_SIZE 0x100000 +#define VIRT_FDT_BASE 0x1c400000 +#define VIRT_FDT_SIZE 0x100000 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" -#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 -#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 /* * 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, LoongArchMachineState *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);/* Address */ + build_append_int_noprefix(table_data, VIRT_PCH_MSI_ADDR_LOW, 8);/* Address */ build_append_int_noprefix(table_data, 0x40, 4); /* Start */ build_append_int_noprefix(table_data, 0xc0, 4); /* Count */ @@ -143,7 +143,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, LoongArchMachineState *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 = LS7A_UART_IRQ; + uint32_t uart_irq = VIRT_UART_IRQ; Aml *scope = aml_scope("_SB"); dev = aml_device("COMA"); @@ -367,7 +367,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, MachineState *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); } @@ -385,9 +385,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, MachineState *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); @@ -462,8 +462,8 @@ static void acpi_build(AcpiBuildTables *tables, MachineState *machine) acpi_add_table(table_offsets, tables_blob); { AcpiMcfgInfo mcfg = { - .base = cpu_to_le64(LS_PCIECFG_BASE), - .size = cpu_to_le64(LS_PCIECFG_SIZE), + .base = cpu_to_le64(VIRT_PCI_CFG_BASE), + .size = 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 LoongArchMachineState *lams) static void fdt_add_pcie_node(const LoongArchMachineState *lams) { char *nodename; - hwaddr base_mmio = LS7A_PCI_MEM_BASE; - hwaddr size_mmio = LS7A_PCI_MEM_SIZE; - hwaddr base_pio = LS7A_PCI_IO_BASE; - hwaddr size_pio = LS7A_PCI_IO_SIZE; - hwaddr base_pcie = LS_PCIECFG_BASE; - hwaddr size_pcie = LS_PCIECFG_SIZE; + hwaddr base_mmio = VIRT_PCI_MEM_BASE; + hwaddr size_mmio = VIRT_PCI_MEM_SIZE; + hwaddr base_pio = VIRT_PCI_IO_BASE; + hwaddr size_pio = VIRT_PCI_IO_SIZE; + hwaddr base_pcie = VIRT_PCI_CFG_BASE; + hwaddr size_pcie = VIRT_PCI_CFG_SIZE; hwaddr base = base_pcie; const MachineState *ms = MACHINE(lams); @@ -145,12 +145,12 @@ static void fdt_add_pcie_node(const LoongArchMachineState *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_OFFSET, + 1, FDT_PCI_RANGE_IOPORT, 2, VIRT_PCI_IO_OFFSET, 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_pic, LoongArchMachineState sysbus_mmio_map(SYS_BUS_DEVICE(dev), 2, VIRT_GED_REG_ADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, - qdev_get_gpio_in(pch_pic, LS7A_SCI_IRQ - PCH_PIC_IRQ_OFFSET)); + qdev_get_gpio_in(pch_pic, VIRT_SCI_IRQ - PCH_PIC_IRQ_OFFSET)); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); return dev; } @@ -336,24 +336,24 @@ static void loongarch_devices_init(DeviceState *pch_pic, LoongArchMachineState * ecam_alias = g_new0(MemoryRegion, 1); ecam_reg = 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); /* Map PCI mem space */ mmio_alias = g_new0(MemoryRegion, 1); mmio_reg = 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_SIZE); - memory_region_add_subregion(get_system_memory(), LS7A_PCI_MEM_BASE, + mmio_reg, VIRT_PCI_MEM_BASE, VIRT_PCI_MEM_SIZE); + memory_region_add_subregion(get_system_memory(), VIRT_PCI_MEM_BASE, mmio_alias); /* Map PCI IO port space. */ pio_alias = g_new0(MemoryRegion, 1); pio_reg = sysbus_mmio_get_region(d, 2); memory_region_init_alias(pio_alias, OBJECT(gpex_dev), "pcie-io", pio_reg, - 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); for (i = 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); } - 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); /* 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)); pm_mem = 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 = qdev_new(TYPE_LOONGARCH_PCH_PIC); d = 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_OFFSET, + VIRT_IOAPIC_REG_BASE + PCH_PIC_ROUTE_ENTRY_OFFSET, 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)); /* Connect 64 pch_pic irqs to extioi */ @@ -490,7 +490,7 @@ static void loongarch_irq_init(LoongArchMachineState *lams) qdev_prop_set_uint32(pch_msi, "msi_irq_base", PCH_MSI_IRQ_START); d = 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 = 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) /* load fdt */ MemoryRegion *fdt_rom = 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_fatal); + memory_region_add_subregion(get_system_memory(), VIRT_FDT_BASE, fdt_rom); + rom_add_blob_fixed("fdt", machine->fdt, lams->fdt_size, VIRT_FDT_BASE); } bool loongarch_is_acpi_enabled(LoongArchMachineState *lams)