linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] PCI: Move PCI_VENDOR_ID_REDHAT definition to pci_ids.h
@ 2020-07-29  6:58 Huacai Chen
  2020-07-29  6:58 ` [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board Huacai Chen
                   ` (3 more replies)
  0 siblings, 4 replies; 23+ messages in thread
From: Huacai Chen @ 2020-07-29  6:58 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Paolo Bonzini, Aleksandar Markovic, Rob Herring
  Cc: linux-mips, kvm, Fuxin Zhang, Huacai Chen, Jiaxun Yang, Huacai Chen

Instead of duplicating the PCI_VENDOR_ID_REDHAT definition everywhere,
move it to include/linux/pci_ids.h is better.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
This patch has been merged into PCI tree, but the current MIPS tree need
it to avoid build error.

 drivers/gpu/drm/qxl/qxl_dev.h           | 2 --
 drivers/net/ethernet/rocker/rocker_hw.h | 1 -
 include/linux/pci_ids.h                 | 2 ++
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_dev.h b/drivers/gpu/drm/qxl/qxl_dev.h
index a0ee416..a7bc31f 100644
--- a/drivers/gpu/drm/qxl/qxl_dev.h
+++ b/drivers/gpu/drm/qxl/qxl_dev.h
@@ -131,8 +131,6 @@ enum SpiceCursorType {
 
 #pragma pack(push, 1)
 
-#define REDHAT_PCI_VENDOR_ID 0x1b36
-
 /* 0x100-0x11f reserved for spice, 0x1ff used for unstable work */
 #define QXL_DEVICE_ID_STABLE 0x0100
 
diff --git a/drivers/net/ethernet/rocker/rocker_hw.h b/drivers/net/ethernet/rocker/rocker_hw.h
index 59f1f8b..62fd84c 100644
--- a/drivers/net/ethernet/rocker/rocker_hw.h
+++ b/drivers/net/ethernet/rocker/rocker_hw.h
@@ -25,7 +25,6 @@ enum {
 
 #define ROCKER_FP_PORTS_MAX 62
 
-#define PCI_VENDOR_ID_REDHAT		0x1b36
 #define PCI_DEVICE_ID_REDHAT_ROCKER	0x0006
 
 #define ROCKER_PCI_BAR0_SIZE		0x2000
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 0ad5769..5c709a1 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2585,6 +2585,8 @@
 
 #define PCI_VENDOR_ID_ASMEDIA		0x1b21
 
+#define PCI_VENDOR_ID_REDHAT		0x1b36
+
 #define PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS	0x1c36
 
 #define PCI_VENDOR_ID_CIRCUITCO		0x1cc8
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board
  2020-07-29  6:58 [PATCH 1/5] PCI: Move PCI_VENDOR_ID_REDHAT definition to pci_ids.h Huacai Chen
@ 2020-07-29  6:58 ` Huacai Chen
  2020-07-29  9:52   ` Thomas Bogendoerfer
  2020-07-29  6:58 ` [PATCH 3/5] MIPS: KVM: Add kvm guest support for Loongson-3 Huacai Chen
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 23+ messages in thread
From: Huacai Chen @ 2020-07-29  6:58 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Paolo Bonzini, Aleksandar Markovic, Rob Herring
  Cc: linux-mips, kvm, Fuxin Zhang, Huacai Chen, Jiaxun Yang, Huacai Chen

Document loongson64v-4core-virtio, a virtio based kvm guest board for
Loongson-3.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
 Documentation/devicetree/bindings/mips/loongson/devices.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/mips/loongson/devices.yaml b/Documentation/devicetree/bindings/mips/loongson/devices.yaml
index 88c5a29..d25e80a 100644
--- a/Documentation/devicetree/bindings/mips/loongson/devices.yaml
+++ b/Documentation/devicetree/bindings/mips/loongson/devices.yaml
@@ -32,4 +32,8 @@ properties:
       - description: Generic Loongson64 Quad Core + LS7A
         items:
           - const: loongson,loongson64g-4core-ls7a
+
+      - description: Virtual Loongson64 Quad Core + VirtIO
+        items:
+          - const: loongson,loongson64v-4core-virtio
 ...
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 3/5] MIPS: KVM: Add kvm guest support for Loongson-3
  2020-07-29  6:58 [PATCH 1/5] PCI: Move PCI_VENDOR_ID_REDHAT definition to pci_ids.h Huacai Chen
  2020-07-29  6:58 ` [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board Huacai Chen
@ 2020-07-29  6:58 ` Huacai Chen
  2020-07-29  6:58 ` [PATCH 4/5] MIPS: Update default config file " Huacai Chen
  2020-07-29  6:58 ` [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers Huacai Chen
  3 siblings, 0 replies; 23+ messages in thread
From: Huacai Chen @ 2020-07-29  6:58 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Paolo Bonzini, Aleksandar Markovic, Rob Herring
  Cc: linux-mips, kvm, Fuxin Zhang, Huacai Chen, Jiaxun Yang, Huacai Chen

Loongson-3 KVM guest is based on virtio, it use liointc as its interrupt
controller and use GPEX as the pci controller.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 arch/mips/Kconfig                                  |   1 +
 arch/mips/boot/dts/loongson/Makefile               |   1 +
 .../boot/dts/loongson/loongson64v_4core_virtio.dts | 102 +++++++++++++++++++++
 arch/mips/include/asm/mach-loongson64/boot_param.h |   4 +-
 .../include/asm/mach-loongson64/builtin_dtbs.h     |   1 +
 arch/mips/loongson64/env.c                         |  15 ++-
 arch/mips/loongson64/init.c                        |   5 +
 7 files changed, 126 insertions(+), 3 deletions(-)
 create mode 100644 arch/mips/boot/dts/loongson/loongson64v_4core_virtio.dts

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index f6bb446..499a20d 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -478,6 +478,7 @@ config MACH_LOONGSON64
 	select COMMON_CLK
 	select USE_OF
 	select BUILTIN_DTB
+	select PCI_HOST_GENERIC
 	help
 	  This enables the support of Loongson-2/3 family of machines.
 
diff --git a/arch/mips/boot/dts/loongson/Makefile b/arch/mips/boot/dts/loongson/Makefile
index ae1c8bf..8fd0efb 100644
--- a/arch/mips/boot/dts/loongson/Makefile
+++ b/arch/mips/boot/dts/loongson/Makefile
@@ -3,5 +3,6 @@ dtb-$(CONFIG_MACH_LOONGSON64)	+= loongson64c_4core_ls7a.dtb
 dtb-$(CONFIG_MACH_LOONGSON64)	+= loongson64c_4core_rs780e.dtb
 dtb-$(CONFIG_MACH_LOONGSON64)	+= loongson64c_8core_rs780e.dtb
 dtb-$(CONFIG_MACH_LOONGSON64)	+= loongson64g_4core_ls7a.dtb
+dtb-$(CONFIG_MACH_LOONGSON64)	+= loongson64v_4core_virtio.dtb
 
 obj-$(CONFIG_BUILTIN_DTB)	+= $(addsuffix .o, $(dtb-y))
diff --git a/arch/mips/boot/dts/loongson/loongson64v_4core_virtio.dts b/arch/mips/boot/dts/loongson/loongson64v_4core_virtio.dts
new file mode 100644
index 00000000..41f0b11
--- /dev/null
+++ b/arch/mips/boot/dts/loongson/loongson64v_4core_virtio.dts
@@ -0,0 +1,102 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/dts-v1/;
+/ {
+	compatible = "loongson,loongson64v-4core-virtio";
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	cpuintc: interrupt-controller {
+		#address-cells = <0>;
+		#interrupt-cells = <1>;
+		interrupt-controller;
+		compatible = "mti,cpu-interrupt-controller";
+	};
+
+	package0: bus@1fe00000 {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <1>;
+		ranges = <0 0x1fe00000 0 0x1fe00000 0x100000
+			0 0x3ff00000 0 0x3ff00000 0x100000
+			0xefd 0xfb000000 0xefd 0xfb000000 0x10000000>;
+
+		liointc: interrupt-controller@3ff01400 {
+			compatible = "loongson,liointc-1.0";
+			reg = <0 0x3ff01400 0x64>;
+
+			interrupt-controller;
+			#interrupt-cells = <2>;
+
+			interrupt-parent = <&cpuintc>;
+			interrupts = <2>, <3>;
+			interrupt-names = "int0", "int1";
+
+			loongson,parent_int_map = <0x00000001>, /* int0 */
+						<0xfffffffe>, /* int1 */
+						<0x00000000>, /* int2 */
+						<0x00000000>; /* int3 */
+
+		};
+
+		cpu_uart0: serial@1fe001e0 {
+			compatible = "ns16550a";
+			reg = <0 0x1fe001e0 0x8>;
+			clock-frequency = <33000000>;
+			interrupt-parent = <&liointc>;
+			interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+			no-loopback-test;
+		};
+	};
+
+	bus@10000000 {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges = <0 0x10000000 0 0x10000000 0 0x10000000 /* PIO & CONF & APB */
+				0 0x40000000 0 0x40000000 0 0x40000000>; /* PCI MEM */
+
+		rtc0: rtc@10081000 {
+			compatible = "google,goldfish-rtc";
+			reg = <0 0x10081000 0 0x1000>;
+			interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-parent = <&liointc>;
+		};
+
+		pci@1a000000 {
+			compatible = "pci-host-ecam-generic";
+			device_type = "pci";
+			#address-cells = <3>;
+			#size-cells = <2>;
+			#interrupt-cells = <1>;
+
+			bus-range = <0x0 0x1f>;
+			reg = <0 0x1a000000 0 0x02000000>;
+
+			ranges = <0x01000000 0x0 0x00004000 0x0 0x18004000 0x0 0x0000c000>,
+				 <0x02000000 0x0 0x40000000 0x0 0x40000000 0x0 0x40000000>;
+
+			interrupt-map = <
+				0x0000 0x0 0x0  0x1  &liointc  0x2 IRQ_TYPE_LEVEL_HIGH
+				0x0800 0x0 0x0  0x1  &liointc  0x3 IRQ_TYPE_LEVEL_HIGH
+				0x1000 0x0 0x0  0x1  &liointc  0x4 IRQ_TYPE_LEVEL_HIGH
+				0x1800 0x0 0x0  0x1  &liointc  0x5 IRQ_TYPE_LEVEL_HIGH
+				>;
+
+			interrupt-map-mask = <0x1800 0x0 0x0  0x7>;
+		};
+
+		isa {
+			compatible = "isa";
+			#address-cells = <2>;
+			#size-cells = <1>;
+			ranges = <1 0 0 0x18000000 0x4000>;
+		};
+	};
+
+	hypervisor {
+		compatible = "linux,kvm";
+	};
+};
diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
index b35be70..afc92b7 100644
--- a/arch/mips/include/asm/mach-loongson64/boot_param.h
+++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
@@ -194,7 +194,8 @@ struct boot_params {
 
 enum loongson_bridge_type {
 	LS7A = 1,
-	RS780E = 2
+	RS780E = 2,
+	VIRTUAL = 3
 };
 
 struct loongson_system_configuration {
@@ -230,5 +231,6 @@ extern struct loongson_system_configuration loongson_sysconf;
 extern u32 node_id_offset;
 extern void ls7a_early_config(void);
 extern void rs780e_early_config(void);
+extern void virtual_early_config(void);
 
 #endif
diff --git a/arch/mips/include/asm/mach-loongson64/builtin_dtbs.h b/arch/mips/include/asm/mach-loongson64/builtin_dtbs.h
index 6d2f141..839410c 100644
--- a/arch/mips/include/asm/mach-loongson64/builtin_dtbs.h
+++ b/arch/mips/include/asm/mach-loongson64/builtin_dtbs.h
@@ -12,4 +12,5 @@ extern u32 __dtb_loongson64c_4core_ls7a_begin[];
 extern u32 __dtb_loongson64c_4core_rs780e_begin[];
 extern u32 __dtb_loongson64c_8core_rs780e_begin[];
 extern u32 __dtb_loongson64g_4core_ls7a_begin[];
+extern u32 __dtb_loongson64v_4core_virtio_begin[];
 #endif
diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
index 2cb9573..99bc199 100644
--- a/arch/mips/loongson64/env.c
+++ b/arch/mips/loongson64/env.c
@@ -167,14 +167,25 @@ void __init prom_init_env(void)
 	vendor = id & 0xffff;
 	device = (id >> 16) & 0xffff;
 
-	if (vendor == PCI_VENDOR_ID_LOONGSON && device == 0x7a00) {
+	switch (vendor) {
+	case PCI_VENDOR_ID_LOONGSON:
 		pr_info("The bridge chip is LS7A\n");
 		loongson_sysconf.bridgetype = LS7A;
 		loongson_sysconf.early_config = ls7a_early_config;
-	} else {
+		break;
+	case PCI_VENDOR_ID_AMD:
+	case PCI_VENDOR_ID_ATI:
 		pr_info("The bridge chip is RS780E or SR5690\n");
 		loongson_sysconf.bridgetype = RS780E;
 		loongson_sysconf.early_config = rs780e_early_config;
+		break;
+	case PCI_VENDOR_ID_REDHAT:
+	default:
+		pr_info("The bridge chip is VIRTUAL\n");
+		loongson_sysconf.bridgetype = VIRTUAL;
+		loongson_sysconf.early_config = virtual_early_config;
+		loongson_fdt_blob = __dtb_loongson64v_4core_virtio_begin;
+		break;
 	}
 
 	if ((read_c0_prid() & PRID_IMP_MASK) == PRID_IMP_LOONGSON_64C) {
diff --git a/arch/mips/loongson64/init.c b/arch/mips/loongson64/init.c
index 8ba22c30..ed75f79 100644
--- a/arch/mips/loongson64/init.c
+++ b/arch/mips/loongson64/init.c
@@ -42,6 +42,11 @@ void rs780e_early_config(void)
 	node_id_offset = 37;
 }
 
+void virtual_early_config(void)
+{
+	node_id_offset = 44;
+}
+
 void __init prom_init(void)
 {
 	fw_init_cmdline();
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 4/5] MIPS: Update default config file for Loongson-3
  2020-07-29  6:58 [PATCH 1/5] PCI: Move PCI_VENDOR_ID_REDHAT definition to pci_ids.h Huacai Chen
  2020-07-29  6:58 ` [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board Huacai Chen
  2020-07-29  6:58 ` [PATCH 3/5] MIPS: KVM: Add kvm guest support for Loongson-3 Huacai Chen
@ 2020-07-29  6:58 ` Huacai Chen
  2020-07-29  6:58 ` [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers Huacai Chen
  3 siblings, 0 replies; 23+ messages in thread
From: Huacai Chen @ 2020-07-29  6:58 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Paolo Bonzini, Aleksandar Markovic, Rob Herring
  Cc: linux-mips, kvm, Fuxin Zhang, Huacai Chen, Jiaxun Yang, Huacai Chen

Update Loongson-3's default config file:
1, Adjust NR_CPUS to 16;
2, Add a built-in cmdline "ieee754=relaxed";
3, Enable MSA, CGROUPS, NAMESPACES, KVM, and XFS support;
4, Enable all possible virtio drivers to support KVM Host/Guest;
5, Enable all necessary netfilter modules to support virtual network;

Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 arch/mips/configs/loongson3_defconfig | 89 ++++++++++++++++++++++++++++++++---
 1 file changed, 83 insertions(+), 6 deletions(-)

diff --git a/arch/mips/configs/loongson3_defconfig b/arch/mips/configs/loongson3_defconfig
index 3d4c7e9..a65b08d 100644
--- a/arch/mips/configs/loongson3_defconfig
+++ b/arch/mips/configs/loongson3_defconfig
@@ -15,7 +15,13 @@ CONFIG_TASK_IO_ACCOUNTING=y
 CONFIG_MEMCG=y
 CONFIG_MEMCG_SWAP=y
 CONFIG_BLK_CGROUP=y
+CONFIG_CGROUP_PIDS=y
+CONFIG_CGROUP_FREEZER=y
 CONFIG_CPUSETS=y
+CONFIG_CGROUP_DEVICE=y
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_NAMESPACES=y
+CONFIG_USER_NS=y
 CONFIG_SCHED_AUTOGROUP=y
 CONFIG_SYSFS_DEPRECATED=y
 CONFIG_RELAY=y
@@ -23,16 +29,16 @@ CONFIG_BLK_DEV_INITRD=y
 CONFIG_EMBEDDED=y
 CONFIG_PERF_EVENTS=y
 CONFIG_MACH_LOONGSON64=y
+CONFIG_CPU_HAS_MSA=y
 CONFIG_SMP=y
+CONFIG_NR_CPUS=16
 CONFIG_HZ_256=y
 CONFIG_KEXEC=y
-CONFIG_PCIEPORTBUS=y
-CONFIG_HOTPLUG_PCI_PCIE=y
-# CONFIG_PCIEAER is not set
-CONFIG_PCIEASPM_PERFORMANCE=y
-CONFIG_HOTPLUG_PCI=y
 CONFIG_MIPS32_O32=y
 CONFIG_MIPS32_N32=y
+CONFIG_VIRTUALIZATION=y
+CONFIG_KVM=m
+CONFIG_KVM_MIPS_VZ=y
 CONFIG_MODULES=y
 CONFIG_MODULE_FORCE_LOAD=y
 CONFIG_MODULE_UNLOAD=y
@@ -56,11 +62,19 @@ CONFIG_IP_MULTIPLE_TABLES=y
 CONFIG_IP_ROUTE_MULTIPATH=y
 CONFIG_IP_ROUTE_VERBOSE=y
 CONFIG_NETFILTER=y
+CONFIG_BRIDGE_NETFILTER=m
 CONFIG_NETFILTER_NETLINK_LOG=m
+CONFIG_NF_CONNTRACK=m
+CONFIG_NF_CONNTRACK_SNMP=m
+CONFIG_NF_TABLES=m
+CONFIG_NFT_CT=m
+CONFIG_NFT_NAT=m
+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
 CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
 CONFIG_NETFILTER_XT_TARGET_MARK=m
 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
 CONFIG_NETFILTER_XT_MATCH_COMMENT=m
+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
 CONFIG_NETFILTER_XT_MATCH_DCCP=m
 CONFIG_NETFILTER_XT_MATCH_ESP=m
 CONFIG_NETFILTER_XT_MATCH_LENGTH=m
@@ -74,28 +88,56 @@ CONFIG_NETFILTER_XT_MATCH_REALM=m
 CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
 CONFIG_NETFILTER_XT_MATCH_STRING=m
 CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+CONFIG_IP_SET=m
 CONFIG_IP_VS=m
+CONFIG_NF_TABLES_IPV4=y
+CONFIG_NF_TABLES_ARP=y
 CONFIG_IP_NF_IPTABLES=m
 CONFIG_IP_NF_MATCH_AH=m
 CONFIG_IP_NF_MATCH_ECN=m
+CONFIG_IP_NF_MATCH_RPFILTER=m
 CONFIG_IP_NF_MATCH_TTL=m
 CONFIG_IP_NF_FILTER=m
 CONFIG_IP_NF_TARGET_REJECT=m
+CONFIG_IP_NF_NAT=m
+CONFIG_IP_NF_TARGET_MASQUERADE=m
 CONFIG_IP_NF_MANGLE=m
 CONFIG_IP_NF_TARGET_ECN=m
 CONFIG_IP_NF_TARGET_TTL=m
 CONFIG_IP_NF_RAW=m
+CONFIG_IP_NF_SECURITY=m
 CONFIG_IP_NF_ARPTABLES=m
 CONFIG_IP_NF_ARPFILTER=m
 CONFIG_IP_NF_ARP_MANGLE=m
+CONFIG_NF_TABLES_IPV6=y
+CONFIG_IP6_NF_IPTABLES=m
+CONFIG_IP6_NF_MATCH_RPFILTER=m
+CONFIG_IP6_NF_FILTER=m
+CONFIG_IP6_NF_TARGET_REJECT=m
+CONFIG_IP6_NF_MANGLE=m
+CONFIG_IP6_NF_RAW=m
+CONFIG_IP6_NF_SECURITY=m
+CONFIG_IP6_NF_NAT=m
+CONFIG_IP6_NF_TARGET_MASQUERADE=m
+CONFIG_NF_TABLES_BRIDGE=m
+CONFIG_BRIDGE_NF_EBTABLES=m
+CONFIG_BRIDGE_EBT_T_FILTER=m
+CONFIG_BRIDGE_EBT_T_NAT=m
 CONFIG_IP_SCTP=m
 CONFIG_L2TP=m
 CONFIG_BRIDGE=m
+CONFIG_VSOCKETS=m
+CONFIG_VIRTIO_VSOCKETS=m
 CONFIG_CFG80211=m
 CONFIG_CFG80211_WEXT=y
 CONFIG_MAC80211=m
 CONFIG_RFKILL=m
 CONFIG_RFKILL_INPUT=y
+CONFIG_NET_9P=m
+CONFIG_NET_9P_VIRTIO=m
+CONFIG_PCIEPORTBUS=y
+# CONFIG_PCIEASPM is not set
+CONFIG_HOTPLUG_PCI=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 CONFIG_MTD=m
@@ -103,6 +145,7 @@ CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_CRYPTOLOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=8192
+CONFIG_VIRTIO_BLK=y
 CONFIG_RAID_ATTRS=m
 CONFIG_BLK_DEV_SD=y
 CONFIG_BLK_DEV_SR=y
@@ -118,6 +161,7 @@ CONFIG_MEGARAID_MM=y
 CONFIG_MEGARAID_MAILBOX=y
 CONFIG_MEGARAID_LEGACY=y
 CONFIG_MEGARAID_SAS=y
+CONFIG_SCSI_VIRTIO=y
 CONFIG_ATA=y
 CONFIG_SATA_AHCI=y
 CONFIG_PATA_ATIIXP=y
@@ -141,7 +185,10 @@ CONFIG_TCM_PSCSI=m
 CONFIG_LOOPBACK_TARGET=m
 CONFIG_ISCSI_TARGET=m
 CONFIG_NETDEVICES=y
+CONFIG_DUMMY=m
 CONFIG_TUN=m
+CONFIG_VETH=m
+CONFIG_VIRTIO_NET=m
 # CONFIG_NET_VENDOR_3COM is not set
 # CONFIG_NET_VENDOR_ADAPTEC is not set
 # CONFIG_NET_VENDOR_ALTEON is not set
@@ -200,6 +247,8 @@ CONFIG_ATH9K=m
 CONFIG_HOSTAP=m
 CONFIG_INPUT_POLLDEV=m
 CONFIG_INPUT_SPARSEKMAP=y
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
 CONFIG_INPUT_EVDEV=y
 CONFIG_KEYBOARD_XTKBD=m
 CONFIG_MOUSE_PS2_SENTELIC=y
@@ -209,7 +258,6 @@ CONFIG_INPUT_UINPUT=m
 CONFIG_SERIO_SERPORT=m
 CONFIG_SERIO_RAW=m
 CONFIG_LEGACY_PTY_COUNT=16
-CONFIG_SERIAL_NONSTANDARD=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_8250_NR_UARTS=16
@@ -218,6 +266,8 @@ CONFIG_SERIAL_8250_MANY_PORTS=y
 CONFIG_SERIAL_8250_SHARE_IRQ=y
 CONFIG_SERIAL_8250_RSA=y
 CONFIG_SERIAL_OF_PLATFORM=y
+CONFIG_SERIAL_NONSTANDARD=y
+CONFIG_VIRTIO_CONSOLE=y
 CONFIG_HW_RANDOM=y
 CONFIG_RAW_DRIVER=m
 CONFIG_I2C_CHARDEV=y
@@ -232,6 +282,8 @@ CONFIG_MEDIA_USB_SUPPORT=y
 CONFIG_USB_VIDEO_CLASS=m
 CONFIG_DRM=y
 CONFIG_DRM_RADEON=m
+CONFIG_DRM_QXL=y
+CONFIG_DRM_VIRTIO_GPU=y
 CONFIG_FB_RADEON=y
 CONFIG_LCD_CLASS_DEVICE=y
 CONFIG_LCD_PLATFORM=m
@@ -248,10 +300,15 @@ CONFIG_SND_SEQ_DUMMY=m
 CONFIG_SND_HDA_INTEL=m
 CONFIG_SND_HDA_PATCH_LOADER=y
 CONFIG_SND_HDA_CODEC_REALTEK=m
+CONFIG_SND_HDA_CODEC_SIGMATEL=m
+CONFIG_SND_HDA_CODEC_HDMI=m
 CONFIG_SND_HDA_CODEC_CONEXANT=m
 # CONFIG_SND_USB is not set
+CONFIG_HIDRAW=y
 CONFIG_HID_A4TECH=m
 CONFIG_HID_SUNPLUS=m
+CONFIG_HID_PID=y
+CONFIG_USB_HIDDEV=y
 CONFIG_USB=y
 CONFIG_USB_MON=y
 CONFIG_USB_XHCI_HCD=m
@@ -264,7 +321,16 @@ CONFIG_USB_SERIAL=m
 CONFIG_USB_SERIAL_OPTION=m
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_CMOS=y
+CONFIG_RTC_DRV_GOLDFISH=y
 CONFIG_DMADEVICES=y
+CONFIG_VIRTIO_PCI=y
+CONFIG_VIRTIO_BALLOON=m
+CONFIG_VIRTIO_INPUT=y
+CONFIG_VIRTIO_MMIO=y
+CONFIG_VHOST_NET=m
+CONFIG_VHOST_SCSI=m
+CONFIG_VHOST_VSOCK=m
+CONFIG_GOLDFISH=y
 CONFIG_PM_DEVFREQ=y
 CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
 CONFIG_DEVFREQ_GOV_PERFORMANCE=y
@@ -277,10 +343,16 @@ CONFIG_EXT2_FS_SECURITY=y
 CONFIG_EXT3_FS=y
 CONFIG_EXT3_FS_POSIX_ACL=y
 CONFIG_EXT3_FS_SECURITY=y
+CONFIG_XFS_FS=y
+CONFIG_XFS_POSIX_ACL=y
 CONFIG_QUOTA=y
 # CONFIG_PRINT_QUOTA_WARNING is not set
+CONFIG_QFMT_V1=m
+CONFIG_QFMT_V2=m
 CONFIG_AUTOFS4_FS=y
 CONFIG_FUSE_FS=m
+CONFIG_VIRTIO_FS=m
+CONFIG_FSCACHE=m
 CONFIG_ISO9660_FS=m
 CONFIG_JOLIET=y
 CONFIG_MSDOS_FS=m
@@ -301,6 +373,9 @@ CONFIG_NFSD=m
 CONFIG_NFSD_V3_ACL=y
 CONFIG_NFSD_V4=y
 CONFIG_CIFS=m
+CONFIG_9P_FS=m
+CONFIG_9P_FSCACHE=y
+CONFIG_9P_FS_POSIX_ACL=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_CODEPAGE_936=y
 CONFIG_NLS_ASCII=y
@@ -334,3 +409,5 @@ CONFIG_MAGIC_SYSRQ=y
 # CONFIG_SCHED_DEBUG is not set
 # CONFIG_DEBUG_PREEMPT is not set
 # CONFIG_FTRACE is not set
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="ieee754=relaxed"
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers
  2020-07-29  6:58 [PATCH 1/5] PCI: Move PCI_VENDOR_ID_REDHAT definition to pci_ids.h Huacai Chen
                   ` (2 preceding siblings ...)
  2020-07-29  6:58 ` [PATCH 4/5] MIPS: Update default config file " Huacai Chen
@ 2020-07-29  6:58 ` Huacai Chen
  2023-06-16  7:18   ` Yu Zhao
  3 siblings, 1 reply; 23+ messages in thread
From: Huacai Chen @ 2020-07-29  6:58 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Paolo Bonzini, Aleksandar Markovic, Rob Herring
  Cc: linux-mips, kvm, Fuxin Zhang, Huacai Chen, Jiaxun Yang, Huacai Chen

James Hogan has become inactive for a long time and leaves KVM for MIPS
orphan. I'm working on KVM/Loongson and attempt to make it upstream both
in kernel and QEMU, while Aleksandar Markovic is already a maintainer of
QEMU/MIPS. We are both interested in QEMU/KVM/MIPS, and we have already
made some contributions in kernel and QEMU. If possible, we want to take
the KVM/MIPS maintainership.

Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 MAINTAINERS | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index bddc79a..5f9c2fd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9441,9 +9441,11 @@ F:	arch/arm64/kvm/
 F:	include/kvm/arm_*
 
 KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)
+M:	Huacai Chen <chenhc@lemote.com>
+M:	Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
 L:	linux-mips@vger.kernel.org
 L:	kvm@vger.kernel.org
-S:	Orphan
+S:	Maintained
 F:	arch/mips/include/asm/kvm*
 F:	arch/mips/include/uapi/asm/kvm*
 F:	arch/mips/kvm/
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board
  2020-07-29  6:58 ` [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board Huacai Chen
@ 2020-07-29  9:52   ` Thomas Bogendoerfer
  2020-07-29 10:08     ` Huacai Chen
  0 siblings, 1 reply; 23+ messages in thread
From: Thomas Bogendoerfer @ 2020-07-29  9:52 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Paolo Bonzini, Aleksandar Markovic, Rob Herring, linux-mips, kvm,
	Fuxin Zhang, Huacai Chen, Jiaxun Yang

On Wed, Jul 29, 2020 at 02:58:36PM +0800, Huacai Chen wrote:
> Document loongson64v-4core-virtio, a virtio based kvm guest board for
> Loongson-3.
> 
> Signed-off-by: Huacai Chen <chenhc@lemote.com>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

hmm, I can't remember adding my signed-off to this patch. Could you
give me a reference for this ?

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board
  2020-07-29  9:52   ` Thomas Bogendoerfer
@ 2020-07-29 10:08     ` Huacai Chen
  2020-07-31  3:01       ` Huacai Chen
  0 siblings, 1 reply; 23+ messages in thread
From: Huacai Chen @ 2020-07-29 10:08 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Paolo Bonzini, Aleksandar Markovic, Rob Herring, open list:MIPS,
	kvm, Fuxin Zhang, Jiaxun Yang

Hi, Thomas,


On Wed, Jul 29, 2020 at 6:00 PM Thomas Bogendoerfer
<tsbogend@alpha.franken.de> wrote:
>
> On Wed, Jul 29, 2020 at 02:58:36PM +0800, Huacai Chen wrote:
> > Document loongson64v-4core-virtio, a virtio based kvm guest board for
> > Loongson-3.
> >
> > Signed-off-by: Huacai Chen <chenhc@lemote.com>
> > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
>
> hmm, I can't remember adding my signed-off to this patch. Could you
> give me a reference for this ?
>
I'm sorry, this is a copy paste error..

Huacai

> Thomas.
>
> --
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board
  2020-07-29 10:08     ` Huacai Chen
@ 2020-07-31  3:01       ` Huacai Chen
  2020-07-31  8:32         ` Thomas Bogendoerfer
  0 siblings, 1 reply; 23+ messages in thread
From: Huacai Chen @ 2020-07-31  3:01 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Paolo Bonzini, Aleksandar Markovic, Rob Herring, open list:MIPS,
	kvm, Fuxin Zhang, Jiaxun Yang

Hi, Thomas,

On Wed, Jul 29, 2020 at 6:08 PM Huacai Chen <chenhc@lemote.com> wrote:
>
> Hi, Thomas,
>
>
> On Wed, Jul 29, 2020 at 6:00 PM Thomas Bogendoerfer
> <tsbogend@alpha.franken.de> wrote:
> >
> > On Wed, Jul 29, 2020 at 02:58:36PM +0800, Huacai Chen wrote:
> > > Document loongson64v-4core-virtio, a virtio based kvm guest board for
> > > Loongson-3.
> > >
> > > Signed-off-by: Huacai Chen <chenhc@lemote.com>
> > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > > Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> >
> > hmm, I can't remember adding my signed-off to this patch. Could you
> > give me a reference for this ?
> >
> I'm sorry, this is a copy paste error..
>
Should I send V2 for this series?

> Huacai
>
> > Thomas.
> >
> > --
> > Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> > good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board
  2020-07-31  3:01       ` Huacai Chen
@ 2020-07-31  8:32         ` Thomas Bogendoerfer
  2020-07-31 11:56           ` Jiaxun Yang
  0 siblings, 1 reply; 23+ messages in thread
From: Thomas Bogendoerfer @ 2020-07-31  8:32 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Paolo Bonzini, Aleksandar Markovic, Rob Herring, open list:MIPS,
	kvm, Fuxin Zhang, Jiaxun Yang

On Fri, Jul 31, 2020 at 11:01:58AM +0800, Huacai Chen wrote:
> Hi, Thomas,
> 
> On Wed, Jul 29, 2020 at 6:08 PM Huacai Chen <chenhc@lemote.com> wrote:
> >
> > Hi, Thomas,
> >
> >
> > On Wed, Jul 29, 2020 at 6:00 PM Thomas Bogendoerfer
> > <tsbogend@alpha.franken.de> wrote:
> > >
> > > On Wed, Jul 29, 2020 at 02:58:36PM +0800, Huacai Chen wrote:
> > > > Document loongson64v-4core-virtio, a virtio based kvm guest board for
> > > > Loongson-3.
> > > >
> > > > Signed-off-by: Huacai Chen <chenhc@lemote.com>
> > > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > > > Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > >
> > > hmm, I can't remember adding my signed-off to this patch. Could you
> > > give me a reference for this ?
> > >
> > I'm sorry, this is a copy paste error..
> >
> Should I send V2 for this series?

no, if nothing else needs a resent. Problem with this series is,
that it touches a few places, so it's not clear who should merge
it...

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board
  2020-07-31  8:32         ` Thomas Bogendoerfer
@ 2020-07-31 11:56           ` Jiaxun Yang
  2020-08-03  6:05             ` Huacai Chen
  0 siblings, 1 reply; 23+ messages in thread
From: Jiaxun Yang @ 2020-07-31 11:56 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Huacai Chen
  Cc: Paolo Bonzini, Aleksandar Markovic, Rob Herring, open list:MIPS,
	kvm, Fuxin Zhang



在 2020/7/31 下午4:32, Thomas Bogendoerfer 写道:
> On Fri, Jul 31, 2020 at 11:01:58AM +0800, Huacai Chen wrote:
>> Hi, Thomas,
>>
>> On Wed, Jul 29, 2020 at 6:08 PM Huacai Chen <chenhc@lemote.com> wrote:
>>> Hi, Thomas,
>>>
>>>
>>> On Wed, Jul 29, 2020 at 6:00 PM Thomas Bogendoerfer
>>> <tsbogend@alpha.franken.de> wrote:
>>>> On Wed, Jul 29, 2020 at 02:58:36PM +0800, Huacai Chen wrote:
>>>>> Document loongson64v-4core-virtio, a virtio based kvm guest board for
>>>>> Loongson-3.
>>>>>
>>>>> Signed-off-by: Huacai Chen <chenhc@lemote.com>
>>>>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>>>>> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
>>>> hmm, I can't remember adding my signed-off to this patch. Could you
>>>> give me a reference for this ?
>>>>
>>> I'm sorry, this is a copy paste error..
>>>
>> Should I send V2 for this series?
> no, if nothing else needs a resent. Problem with this series is,
> that it touches a few places, so it's not clear who should merge
> it...

Actually the first patch is already in the next. I suspect they should 
go through MIPS tree.
Probably this patch needs a ack from Rob?

- Jiaxun

>
> Thomas.
>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board
  2020-07-31 11:56           ` Jiaxun Yang
@ 2020-08-03  6:05             ` Huacai Chen
  2020-08-03  9:13               ` Jiaxun Yang
  0 siblings, 1 reply; 23+ messages in thread
From: Huacai Chen @ 2020-08-03  6:05 UTC (permalink / raw)
  To: Jiaxun Yang
  Cc: Thomas Bogendoerfer, Paolo Bonzini, Aleksandar Markovic,
	Rob Herring, open list:MIPS, kvm, Fuxin Zhang

Hi, Thomas,

On Fri, Jul 31, 2020 at 7:57 PM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>
>
>
> 在 2020/7/31 下午4:32, Thomas Bogendoerfer 写道:
> > On Fri, Jul 31, 2020 at 11:01:58AM +0800, Huacai Chen wrote:
> >> Hi, Thomas,
> >>
> >> On Wed, Jul 29, 2020 at 6:08 PM Huacai Chen <chenhc@lemote.com> wrote:
> >>> Hi, Thomas,
> >>>
> >>>
> >>> On Wed, Jul 29, 2020 at 6:00 PM Thomas Bogendoerfer
> >>> <tsbogend@alpha.franken.de> wrote:
> >>>> On Wed, Jul 29, 2020 at 02:58:36PM +0800, Huacai Chen wrote:
> >>>>> Document loongson64v-4core-virtio, a virtio based kvm guest board for
> >>>>> Loongson-3.
> >>>>>
> >>>>> Signed-off-by: Huacai Chen <chenhc@lemote.com>
> >>>>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> >>>>> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> >>>> hmm, I can't remember adding my signed-off to this patch. Could you
> >>>> give me a reference for this ?
> >>>>
> >>> I'm sorry, this is a copy paste error..
> >>>
> >> Should I send V2 for this series?
> > no, if nothing else needs a resent. Problem with this series is,
> > that it touches a few places, so it's not clear who should merge
> > it...
>
> Actually the first patch is already in the next. I suspect they should
> go through MIPS tree.
> Probably this patch needs a ack from Rob?
I agree with Jiaxun, this series should go through MIPS tree.

Huacai
>
> - Jiaxun
>
> >
> > Thomas.
> >

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board
  2020-08-03  6:05             ` Huacai Chen
@ 2020-08-03  9:13               ` Jiaxun Yang
  2020-08-04  7:47                 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 23+ messages in thread
From: Jiaxun Yang @ 2020-08-03  9:13 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Thomas Bogendoerfer, Paolo Bonzini, Aleksandar Markovic,
	Rob Herring, open list:MIPS, kvm, Fuxin Zhang



在 2020/8/3 下午2:05, Huacai Chen 写道:
> Hi, Thomas,
>
> On Fri, Jul 31, 2020 at 7:57 PM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>>
>>
>> 在 2020/7/31 下午4:32, Thomas Bogendoerfer 写道:
>>> On Fri, Jul 31, 2020 at 11:01:58AM +0800, Huacai Chen wrote:
>>>> Hi, Thomas,
>>>>
>>>> On Wed, Jul 29, 2020 at 6:08 PM Huacai Chen <chenhc@lemote.com> wrote:
>>>>> Hi, Thomas,
>>>>>
>>>>>
>>>>> On Wed, Jul 29, 2020 at 6:00 PM Thomas Bogendoerfer
>>>>> <tsbogend@alpha.franken.de> wrote:
>>>>>> On Wed, Jul 29, 2020 at 02:58:36PM +0800, Huacai Chen wrote:
>>>>>>> Document loongson64v-4core-virtio, a virtio based kvm guest board for
>>>>>>> Loongson-3.
>>>>>>>
>>>>>>> Signed-off-by: Huacai Chen <chenhc@lemote.com>
>>>>>>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>>>>>>> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
>>>>>> hmm, I can't remember adding my signed-off to this patch. Could you
>>>>>> give me a reference for this ?
>>>>>>
>>>>> I'm sorry, this is a copy paste error..
>>>>>
>>>> Should I send V2 for this series?
>>> no, if nothing else needs a resent. Problem with this series is,
>>> that it touches a few places, so it's not clear who should merge
>>> it...
>> Actually the first patch is already in the next. I suspect they should
>> go through MIPS tree.
>> Probably this patch needs a ack from Rob?
> I agree with Jiaxun, this series should go through MIPS tree.

I'd suggest to have a topic branch for this after getting PCI tree merged.

Anyway, I really wish to see this as a part of 5.9 release.

Thanks.

- Jiaxun
>
> Huacai
>> - Jiaxun
>>
>>> Thomas.
>>>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board
  2020-08-03  9:13               ` Jiaxun Yang
@ 2020-08-04  7:47                 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 23+ messages in thread
From: Thomas Bogendoerfer @ 2020-08-04  7:47 UTC (permalink / raw)
  To: Jiaxun Yang
  Cc: Huacai Chen, Paolo Bonzini, Aleksandar Markovic, Rob Herring,
	open list:MIPS, kvm, Fuxin Zhang

On Mon, Aug 03, 2020 at 05:13:39PM +0800, Jiaxun Yang wrote:
> 
> 
> 在 2020/8/3 下午2:05, Huacai Chen 写道:
> >Hi, Thomas,
> >
> >On Fri, Jul 31, 2020 at 7:57 PM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
> >>
> >>
> >>在 2020/7/31 下午4:32, Thomas Bogendoerfer 写道:
> >>>On Fri, Jul 31, 2020 at 11:01:58AM +0800, Huacai Chen wrote:
> >>>>Hi, Thomas,
> >>>>
> >>>>On Wed, Jul 29, 2020 at 6:08 PM Huacai Chen <chenhc@lemote.com> wrote:
> >>>>>Hi, Thomas,
> >>>>>
> >>>>>
> >>>>>On Wed, Jul 29, 2020 at 6:00 PM Thomas Bogendoerfer
> >>>>><tsbogend@alpha.franken.de> wrote:
> >>>>>>On Wed, Jul 29, 2020 at 02:58:36PM +0800, Huacai Chen wrote:
> >>>>>>>Document loongson64v-4core-virtio, a virtio based kvm guest board for
> >>>>>>>Loongson-3.
> >>>>>>>
> >>>>>>>Signed-off-by: Huacai Chen <chenhc@lemote.com>
> >>>>>>>Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> >>>>>>>Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> >>>>>>hmm, I can't remember adding my signed-off to this patch. Could you
> >>>>>>give me a reference for this ?
> >>>>>>
> >>>>>I'm sorry, this is a copy paste error..
> >>>>>
> >>>>Should I send V2 for this series?
> >>>no, if nothing else needs a resent. Problem with this series is,
> >>>that it touches a few places, so it's not clear who should merge
> >>>it...
> >>Actually the first patch is already in the next. I suspect they should
> >>go through MIPS tree.
> >>Probably this patch needs a ack from Rob?
> >I agree with Jiaxun, this series should go through MIPS tree.
> 
> I'd suggest to have a topic branch for this after getting PCI tree merged.
> 
> Anyway, I really wish to see this as a part of 5.9 release.

I've applied patches 2-5 to mips-next. To avoid the mess with the
first patch, I've removed the case PCI_VENDOR_ID_REDHAT: from
patch 3 as this is the same as the default: case. It would help
a lot to not mix patches to different trees in one series next time.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers
  2020-07-29  6:58 ` [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers Huacai Chen
@ 2023-06-16  7:18   ` Yu Zhao
  2023-06-16  7:55     ` Huacai Chen
  2023-06-16  8:23     ` Thomas Bogendoerfer
  0 siblings, 2 replies; 23+ messages in thread
From: Yu Zhao @ 2023-06-16  7:18 UTC (permalink / raw)
  To: chenhuacai, aleksandar.qemu.devel, tsbogend
  Cc: jiaxun.yang, kvm, linux-mips, pbonzini, robh+dt, zhangfx

On Tue, Jul 28, 2020 at 23:58:20PM -0700, Huacai Chen wrote:
> James Hogan has become inactive for a long time and leaves KVM for MIPS
> orphan. I'm working on KVM/Loongson and attempt to make it upstream both
> in kernel and QEMU, while Aleksandar Markovic is already a maintainer of
> QEMU/MIPS. We are both interested in QEMU/KVM/MIPS, and we have already
> made some contributions in kernel and QEMU. If possible, we want to take
> the KVM/MIPS maintainership.
>
> Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> Signed-off-by: Huacai Chen <chenhc@lemote.com>
> ---
>  MAINTAINERS | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index bddc79a..5f9c2fd 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -9441,9 +9441,11 @@ F:	arch/arm64/kvm/
>  F:	include/kvm/arm_*
>
>  KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)
> +M:	Huacai Chen <chenhc@lemote.com>
> +M:	Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
>  L:	linux-mips@vger.kernel.org
>  L:	kvm@vger.kernel.org
> -S:	Orphan
> +S:	Maintained
>  F:	arch/mips/include/asm/kvm*
>  F:	arch/mips/include/uapi/asm/kvm*
>  F:	arch/mips/kvm/

Hi,

Is kvm/mips still maintained? Thanks.

I tried v6.4-rc6 and hit the following crash. It seems it has been broken since

  commit 45c7e8af4a5e3f0bea4ac209eea34118dd57ac64
  Author: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
  Date:   Mon Mar 1 16:29:57 2021 +0100
  
      MIPS: Remove KVM_TE support
      
      After removal of the guest part of KVM TE (trap and emulate), also remove
      the host part.

which deletes kvm_mips_commpage_init() and leaves vcpu->arch.cop0 NULL.

(Or probably I've missed something.)

  $ sudo qemu-system-mips64el -M accel=kvm -nographic
  CPU 2 Unable to handle kernel paging request at virtual address 0000000000000300, epc == ffffffff81148288, ra == ffffffff81148228
  Oops[#1]:
  CPU: 2 PID: 339 Comm: qemu-system-mip Not tainted 6.4.0-rc6-00049-g62d8779610bb #3
  $ 0   : 0000000000000000 0000000034109ce1 0000000000400004 ffffffff81b50200
  $ 4   : 8000000001d71c00 0000000000000001 0000000000000000 0000000000000000
  $ 8   : 000000a64082989c 000000000000001f 000000000000000a 0000000000000060
  $12   : ffffffff81935390 eb0ffdb582d1ed00 0000000000000001 0000000000000000
  $16   : 0000000000000000 8000000005193330 8000000005193330 80000000058b6000
  $20   : 80000000058b4a00 ffffffff81b5f110 0000000000000000 ffffffffffffffff
  $24   : 0000000000000001 ffffffff811331a0
  $28   : 80000000021e8000 80000000021ebc90 000000fff1369160 ffffffff81148228
  Hi    : 0000000000000000
  Lo    : 00000000083e6217
  epc   : ffffffff81148288 kvm_vz_vcpu_setup+0xa8/0x2d8
  ra    : ffffffff81148228 kvm_vz_vcpu_setup+0x48/0x2d8
  Status: 34109ce3	KX SX UX KERNEL EXL IE
  Cause : 0080000c (ExcCode 03)
  BadVA : 0000000000000300
  PrId  : 000d9602 (Cavium Octeon III)
  Modules linked in:
  Process qemu-system-mip (pid: 339, threadinfo=0000000029889cef, task=0000000070662173, tls=000000fff1371140)
  Stack : 8000000005193330 80000000058b4a00 80000000058b4000 ffffffff81142184
          80000000021ebcd8 eb0ffdb582d1ed00 ffffffff81b50000 ffffffff81b50000
          800000000537e000 0000000000000000 800000000537e920 8000000005193330
          ffffffff81c10000 ffffffff8113fd94 0000000000000cc0 000000000ffdc000
          000000ffdc000000 000000ffdc000010 0000000000000255 8000000003416700
          8000000005923ff8 0000000000000000 0000000000000000 0000000000000000
          8000000004775000 800000004d91dd68 0000000000000000 eb0ffdb582d1ed00
          0000000000000801 0000000000000255 ffffffff81b526a8 0000000000000001
          0000000000000001 ffffffff812c4b84 8000000002238180 0000000000000255
          0000000000000000 eb0ffdb582d1ed00 000000ffdc000010 8000000003717200
          ...
  Call Trace:
  [<ffffffff81148288>] kvm_vz_vcpu_setup+0xa8/0x2d8
  [<ffffffff81142184>] kvm_arch_vcpu_create+0x12c/0x1c0
  [<ffffffff8113fd94>] kvm_vm_ioctl+0x5e4/0xda0
  [<ffffffff812ef070>] sys_ioctl+0xb8/0x100
  [<ffffffff81125930>] syscall_common+0x34/0x58
  
  Code: 3c040040  24840004  00441025 <fe020300> 40626001  3c04ff80  00441024  3c048000  7c42f803
  
  ---[ end trace 0000000000000000 ]---

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers
  2023-06-16  7:18   ` Yu Zhao
@ 2023-06-16  7:55     ` Huacai Chen
  2023-06-16  8:23     ` Thomas Bogendoerfer
  1 sibling, 0 replies; 23+ messages in thread
From: Huacai Chen @ 2023-06-16  7:55 UTC (permalink / raw)
  To: Yu Zhao
  Cc: aleksandar.qemu.devel, tsbogend, jiaxun.yang, kvm, linux-mips,
	pbonzini, robh+dt, zhangfx

Hi, Zhao,

On Fri, Jun 16, 2023 at 3:18 PM Yu Zhao <yuzhao@google.com> wrote:
>
> On Tue, Jul 28, 2020 at 23:58:20PM -0700, Huacai Chen wrote:
> > James Hogan has become inactive for a long time and leaves KVM for MIPS
> > orphan. I'm working on KVM/Loongson and attempt to make it upstream both
> > in kernel and QEMU, while Aleksandar Markovic is already a maintainer of
> > QEMU/MIPS. We are both interested in QEMU/KVM/MIPS, and we have already
> > made some contributions in kernel and QEMU. If possible, we want to take
> > the KVM/MIPS maintainership.
> >
> > Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > Signed-off-by: Huacai Chen <chenhc@lemote.com>
> > ---
> >  MAINTAINERS | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index bddc79a..5f9c2fd 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -9441,9 +9441,11 @@ F:     arch/arm64/kvm/
> >  F:   include/kvm/arm_*
> >
> >  KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)
> > +M:   Huacai Chen <chenhc@lemote.com>
> > +M:   Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> >  L:   linux-mips@vger.kernel.org
> >  L:   kvm@vger.kernel.org
> > -S:   Orphan
> > +S:   Maintained
> >  F:   arch/mips/include/asm/kvm*
> >  F:   arch/mips/include/uapi/asm/kvm*
> >  F:   arch/mips/kvm/
>
> Hi,
>
> Is kvm/mips still maintained? Thanks.
>
> I tried v6.4-rc6 and hit the following crash. It seems it has been broken since
>
>   commit 45c7e8af4a5e3f0bea4ac209eea34118dd57ac64
>   Author: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
>   Date:   Mon Mar 1 16:29:57 2021 +0100
>
>       MIPS: Remove KVM_TE support
>
>       After removal of the guest part of KVM TE (trap and emulate), also remove
>       the host part.
>
> which deletes kvm_mips_commpage_init() and leaves vcpu->arch.cop0 NULL.
I think your analysis is correct, are you interested in fixing it?

Huacai

>
> (Or probably I've missed something.)
>
>   $ sudo qemu-system-mips64el -M accel=kvm -nographic
>   CPU 2 Unable to handle kernel paging request at virtual address 0000000000000300, epc == ffffffff81148288, ra == ffffffff81148228
>   Oops[#1]:
>   CPU: 2 PID: 339 Comm: qemu-system-mip Not tainted 6.4.0-rc6-00049-g62d8779610bb #3
>   $ 0   : 0000000000000000 0000000034109ce1 0000000000400004 ffffffff81b50200
>   $ 4   : 8000000001d71c00 0000000000000001 0000000000000000 0000000000000000
>   $ 8   : 000000a64082989c 000000000000001f 000000000000000a 0000000000000060
>   $12   : ffffffff81935390 eb0ffdb582d1ed00 0000000000000001 0000000000000000
>   $16   : 0000000000000000 8000000005193330 8000000005193330 80000000058b6000
>   $20   : 80000000058b4a00 ffffffff81b5f110 0000000000000000 ffffffffffffffff
>   $24   : 0000000000000001 ffffffff811331a0
>   $28   : 80000000021e8000 80000000021ebc90 000000fff1369160 ffffffff81148228
>   Hi    : 0000000000000000
>   Lo    : 00000000083e6217
>   epc   : ffffffff81148288 kvm_vz_vcpu_setup+0xa8/0x2d8
>   ra    : ffffffff81148228 kvm_vz_vcpu_setup+0x48/0x2d8
>   Status: 34109ce3      KX SX UX KERNEL EXL IE
>   Cause : 0080000c (ExcCode 03)
>   BadVA : 0000000000000300
>   PrId  : 000d9602 (Cavium Octeon III)
>   Modules linked in:
>   Process qemu-system-mip (pid: 339, threadinfo=0000000029889cef, task=0000000070662173, tls=000000fff1371140)
>   Stack : 8000000005193330 80000000058b4a00 80000000058b4000 ffffffff81142184
>           80000000021ebcd8 eb0ffdb582d1ed00 ffffffff81b50000 ffffffff81b50000
>           800000000537e000 0000000000000000 800000000537e920 8000000005193330
>           ffffffff81c10000 ffffffff8113fd94 0000000000000cc0 000000000ffdc000
>           000000ffdc000000 000000ffdc000010 0000000000000255 8000000003416700
>           8000000005923ff8 0000000000000000 0000000000000000 0000000000000000
>           8000000004775000 800000004d91dd68 0000000000000000 eb0ffdb582d1ed00
>           0000000000000801 0000000000000255 ffffffff81b526a8 0000000000000001
>           0000000000000001 ffffffff812c4b84 8000000002238180 0000000000000255
>           0000000000000000 eb0ffdb582d1ed00 000000ffdc000010 8000000003717200
>           ...
>   Call Trace:
>   [<ffffffff81148288>] kvm_vz_vcpu_setup+0xa8/0x2d8
>   [<ffffffff81142184>] kvm_arch_vcpu_create+0x12c/0x1c0
>   [<ffffffff8113fd94>] kvm_vm_ioctl+0x5e4/0xda0
>   [<ffffffff812ef070>] sys_ioctl+0xb8/0x100
>   [<ffffffff81125930>] syscall_common+0x34/0x58
>
>   Code: 3c040040  24840004  00441025 <fe020300> 40626001  3c04ff80  00441024  3c048000  7c42f803
>
>   ---[ end trace 0000000000000000 ]---

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers
  2023-06-16  7:18   ` Yu Zhao
  2023-06-16  7:55     ` Huacai Chen
@ 2023-06-16  8:23     ` Thomas Bogendoerfer
  2023-06-16  8:31       ` Huacai Chen
  2023-06-17  1:52       ` Yu Zhao
  1 sibling, 2 replies; 23+ messages in thread
From: Thomas Bogendoerfer @ 2023-06-16  8:23 UTC (permalink / raw)
  To: Yu Zhao
  Cc: chenhuacai, aleksandar.qemu.devel, jiaxun.yang, kvm, linux-mips,
	pbonzini, robh+dt, zhangfx

On Fri, Jun 16, 2023 at 01:18:31AM -0600, Yu Zhao wrote:
> On Tue, Jul 28, 2020 at 23:58:20PM -0700, Huacai Chen wrote:
> > James Hogan has become inactive for a long time and leaves KVM for MIPS
> > orphan. I'm working on KVM/Loongson and attempt to make it upstream both
> > in kernel and QEMU, while Aleksandar Markovic is already a maintainer of
> > QEMU/MIPS. We are both interested in QEMU/KVM/MIPS, and we have already
> > made some contributions in kernel and QEMU. If possible, we want to take
> > the KVM/MIPS maintainership.
> >
> > Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > Signed-off-by: Huacai Chen <chenhc@lemote.com>
> > ---
> >  MAINTAINERS | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index bddc79a..5f9c2fd 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -9441,9 +9441,11 @@ F:	arch/arm64/kvm/
> >  F:	include/kvm/arm_*
> >
> >  KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)
> > +M:	Huacai Chen <chenhc@lemote.com>
> > +M:	Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> >  L:	linux-mips@vger.kernel.org
> >  L:	kvm@vger.kernel.org
> > -S:	Orphan
> > +S:	Maintained
> >  F:	arch/mips/include/asm/kvm*
> >  F:	arch/mips/include/uapi/asm/kvm*
> >  F:	arch/mips/kvm/
> 
> Hi,
> 
> Is kvm/mips still maintained? Thanks.
> 
> I tried v6.4-rc6 and hit the following crash. It seems it has been broken since
> 
>   commit 45c7e8af4a5e3f0bea4ac209eea34118dd57ac64
>   Author: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
>   Date:   Mon Mar 1 16:29:57 2021 +0100
>   
>       MIPS: Remove KVM_TE support

ok, I see what I missed when removing TE support, d'oh. Does the patch
below fix the issue for you ?

Thomas.

diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
index 957121a495f0..04cedf9f8811 100644
--- a/arch/mips/include/asm/kvm_host.h
+++ b/arch/mips/include/asm/kvm_host.h
@@ -317,7 +317,7 @@ struct kvm_vcpu_arch {
 	unsigned int aux_inuse;
 
 	/* COP0 State */
-	struct mips_coproc *cop0;
+	struct mips_coproc cop0;
 
 	/* Resume PC after MMIO completion */
 	unsigned long io_pc;
@@ -698,7 +698,7 @@ static inline bool kvm_mips_guest_can_have_fpu(struct kvm_vcpu_arch *vcpu)
 static inline bool kvm_mips_guest_has_fpu(struct kvm_vcpu_arch *vcpu)
 {
 	return kvm_mips_guest_can_have_fpu(vcpu) &&
-		kvm_read_c0_guest_config1(vcpu->cop0) & MIPS_CONF1_FP;
+		kvm_read_c0_guest_config1(&vcpu->cop0) & MIPS_CONF1_FP;
 }
 
 static inline bool kvm_mips_guest_can_have_msa(struct kvm_vcpu_arch *vcpu)
@@ -710,7 +710,7 @@ static inline bool kvm_mips_guest_can_have_msa(struct kvm_vcpu_arch *vcpu)
 static inline bool kvm_mips_guest_has_msa(struct kvm_vcpu_arch *vcpu)
 {
 	return kvm_mips_guest_can_have_msa(vcpu) &&
-		kvm_read_c0_guest_config3(vcpu->cop0) & MIPS_CONF3_MSA;
+		kvm_read_c0_guest_config3(&vcpu->cop0) & MIPS_CONF3_MSA;
 }
 
 struct kvm_mips_callbacks {
diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
index edaec93a1a1f..e64372b8f66a 100644
--- a/arch/mips/kvm/emulate.c
+++ b/arch/mips/kvm/emulate.c
@@ -312,7 +312,7 @@ int kvm_get_badinstrp(u32 *opc, struct kvm_vcpu *vcpu, u32 *out)
  */
 int kvm_mips_count_disabled(struct kvm_vcpu *vcpu)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 
 	return	(vcpu->arch.count_ctl & KVM_REG_MIPS_COUNT_CTL_DC) ||
 		(kvm_read_c0_guest_cause(cop0) & CAUSEF_DC);
@@ -384,7 +384,7 @@ static inline ktime_t kvm_mips_count_time(struct kvm_vcpu *vcpu)
  */
 static u32 kvm_mips_read_count_running(struct kvm_vcpu *vcpu, ktime_t now)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	ktime_t expires, threshold;
 	u32 count, compare;
 	int running;
@@ -444,7 +444,7 @@ static u32 kvm_mips_read_count_running(struct kvm_vcpu *vcpu, ktime_t now)
  */
 u32 kvm_mips_read_count(struct kvm_vcpu *vcpu)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 
 	/* If count disabled just read static copy of count */
 	if (kvm_mips_count_disabled(vcpu))
@@ -502,7 +502,7 @@ ktime_t kvm_mips_freeze_hrtimer(struct kvm_vcpu *vcpu, u32 *count)
 static void kvm_mips_resume_hrtimer(struct kvm_vcpu *vcpu,
 				    ktime_t now, u32 count)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	u32 compare;
 	u64 delta;
 	ktime_t expire;
@@ -603,7 +603,7 @@ int kvm_mips_restore_hrtimer(struct kvm_vcpu *vcpu, ktime_t before,
  */
 void kvm_mips_write_count(struct kvm_vcpu *vcpu, u32 count)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	ktime_t now;
 
 	/* Calculate bias */
@@ -649,7 +649,7 @@ void kvm_mips_init_count(struct kvm_vcpu *vcpu, unsigned long count_hz)
  */
 int kvm_mips_set_count_hz(struct kvm_vcpu *vcpu, s64 count_hz)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	int dc;
 	ktime_t now;
 	u32 count;
@@ -696,7 +696,7 @@ int kvm_mips_set_count_hz(struct kvm_vcpu *vcpu, s64 count_hz)
  */
 void kvm_mips_write_compare(struct kvm_vcpu *vcpu, u32 compare, bool ack)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	int dc;
 	u32 old_compare = kvm_read_c0_guest_compare(cop0);
 	s32 delta = compare - old_compare;
@@ -779,7 +779,7 @@ void kvm_mips_write_compare(struct kvm_vcpu *vcpu, u32 compare, bool ack)
  */
 static ktime_t kvm_mips_count_disable(struct kvm_vcpu *vcpu)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	u32 count;
 	ktime_t now;
 
@@ -806,7 +806,7 @@ static ktime_t kvm_mips_count_disable(struct kvm_vcpu *vcpu)
  */
 void kvm_mips_count_disable_cause(struct kvm_vcpu *vcpu)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 
 	kvm_set_c0_guest_cause(cop0, CAUSEF_DC);
 	if (!(vcpu->arch.count_ctl & KVM_REG_MIPS_COUNT_CTL_DC))
@@ -826,7 +826,7 @@ void kvm_mips_count_disable_cause(struct kvm_vcpu *vcpu)
  */
 void kvm_mips_count_enable_cause(struct kvm_vcpu *vcpu)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	u32 count;
 
 	kvm_clear_c0_guest_cause(cop0, CAUSEF_DC);
@@ -852,7 +852,7 @@ void kvm_mips_count_enable_cause(struct kvm_vcpu *vcpu)
  */
 int kvm_mips_set_count_ctl(struct kvm_vcpu *vcpu, s64 count_ctl)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	s64 changed = count_ctl ^ vcpu->arch.count_ctl;
 	s64 delta;
 	ktime_t expire, now;
diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c
index 884be4ef99dc..aa5583a7b05b 100644
--- a/arch/mips/kvm/mips.c
+++ b/arch/mips/kvm/mips.c
@@ -649,7 +649,7 @@ static int kvm_mips_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices)
 static int kvm_mips_get_reg(struct kvm_vcpu *vcpu,
 			    const struct kvm_one_reg *reg)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	struct mips_fpu_struct *fpu = &vcpu->arch.fpu;
 	int ret;
 	s64 v;
@@ -761,7 +761,7 @@ static int kvm_mips_get_reg(struct kvm_vcpu *vcpu,
 static int kvm_mips_set_reg(struct kvm_vcpu *vcpu,
 			    const struct kvm_one_reg *reg)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	struct mips_fpu_struct *fpu = &vcpu->arch.fpu;
 	s64 v;
 	s64 vs[2];
@@ -1086,7 +1086,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
 {
 	return kvm_mips_pending_timer(vcpu) ||
-		kvm_read_c0_guest_cause(vcpu->arch.cop0) & C_TI;
+		kvm_read_c0_guest_cause(&vcpu->arch.cop0) & C_TI;
 }
 
 int kvm_arch_vcpu_dump_regs(struct kvm_vcpu *vcpu)
@@ -1110,7 +1110,7 @@ int kvm_arch_vcpu_dump_regs(struct kvm_vcpu *vcpu)
 	kvm_debug("\thi: 0x%08lx\n", vcpu->arch.hi);
 	kvm_debug("\tlo: 0x%08lx\n", vcpu->arch.lo);
 
-	cop0 = vcpu->arch.cop0;
+	cop0 = &vcpu->arch.cop0;
 	kvm_debug("\tStatus: 0x%08x, Cause: 0x%08x\n",
 		  kvm_read_c0_guest_status(cop0),
 		  kvm_read_c0_guest_cause(cop0));
@@ -1232,7 +1232,7 @@ static int __kvm_mips_handle_exit(struct kvm_vcpu *vcpu)
 
 	case EXCCODE_TLBS:
 		kvm_debug("TLB ST fault:  cause %#x, status %#x, PC: %p, BadVaddr: %#lx\n",
-			  cause, kvm_read_c0_guest_status(vcpu->arch.cop0), opc,
+			  cause, kvm_read_c0_guest_status(&vcpu->arch.cop0), opc,
 			  badvaddr);
 
 		++vcpu->stat.tlbmiss_st_exits;
@@ -1304,7 +1304,7 @@ static int __kvm_mips_handle_exit(struct kvm_vcpu *vcpu)
 		kvm_get_badinstr(opc, vcpu, &inst);
 		kvm_err("Exception Code: %d, not yet handled, @ PC: %p, inst: 0x%08x  BadVaddr: %#lx Status: %#x\n",
 			exccode, opc, inst, badvaddr,
-			kvm_read_c0_guest_status(vcpu->arch.cop0));
+			kvm_read_c0_guest_status(&vcpu->arch.cop0));
 		kvm_arch_vcpu_dump_regs(vcpu);
 		run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
 		ret = RESUME_HOST;
@@ -1377,7 +1377,7 @@ int noinstr kvm_mips_handle_exit(struct kvm_vcpu *vcpu)
 /* Enable FPU for guest and restore context */
 void kvm_own_fpu(struct kvm_vcpu *vcpu)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	unsigned int sr, cfg5;
 
 	preempt_disable();
@@ -1421,7 +1421,7 @@ void kvm_own_fpu(struct kvm_vcpu *vcpu)
 /* Enable MSA for guest and restore context */
 void kvm_own_msa(struct kvm_vcpu *vcpu)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	unsigned int sr, cfg5;
 
 	preempt_disable();
diff --git a/arch/mips/kvm/vz.c b/arch/mips/kvm/vz.c
index 3d21cbfa7443..99d5a71e4300 100644
--- a/arch/mips/kvm/vz.c
+++ b/arch/mips/kvm/vz.c
@@ -422,7 +422,7 @@ static void _kvm_vz_restore_htimer(struct kvm_vcpu *vcpu,
  */
 static void kvm_vz_restore_timer(struct kvm_vcpu *vcpu)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	u32 cause, compare;
 
 	compare = kvm_read_sw_gc0_compare(cop0);
@@ -517,7 +517,7 @@ static void _kvm_vz_save_htimer(struct kvm_vcpu *vcpu,
  */
 static void kvm_vz_save_timer(struct kvm_vcpu *vcpu)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	u32 gctl0, compare, cause;
 
 	gctl0 = read_c0_guestctl0();
@@ -863,7 +863,7 @@ static unsigned long mips_process_maar(unsigned int op, unsigned long val)
 
 static void kvm_write_maari(struct kvm_vcpu *vcpu, unsigned long val)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 
 	val &= MIPS_MAARI_INDEX;
 	if (val == MIPS_MAARI_INDEX)
@@ -876,7 +876,7 @@ static enum emulation_result kvm_vz_gpsi_cop0(union mips_instruction inst,
 					      u32 *opc, u32 cause,
 					      struct kvm_vcpu *vcpu)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	enum emulation_result er = EMULATE_DONE;
 	u32 rt, rd, sel;
 	unsigned long curr_pc;
@@ -1911,7 +1911,7 @@ static int kvm_vz_get_one_reg(struct kvm_vcpu *vcpu,
 			      const struct kvm_one_reg *reg,
 			      s64 *v)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	unsigned int idx;
 
 	switch (reg->id) {
@@ -2081,7 +2081,7 @@ static int kvm_vz_get_one_reg(struct kvm_vcpu *vcpu,
 	case KVM_REG_MIPS_CP0_MAARI:
 		if (!cpu_guest_has_maar || cpu_guest_has_dyn_maar)
 			return -EINVAL;
-		*v = kvm_read_sw_gc0_maari(vcpu->arch.cop0);
+		*v = kvm_read_sw_gc0_maari(&vcpu->arch.cop0);
 		break;
 #ifdef CONFIG_64BIT
 	case KVM_REG_MIPS_CP0_XCONTEXT:
@@ -2135,7 +2135,7 @@ static int kvm_vz_set_one_reg(struct kvm_vcpu *vcpu,
 			      const struct kvm_one_reg *reg,
 			      s64 v)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	unsigned int idx;
 	int ret = 0;
 	unsigned int cur, change;
@@ -2562,7 +2562,7 @@ static void kvm_vz_vcpu_load_tlb(struct kvm_vcpu *vcpu, int cpu)
 
 static int kvm_vz_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	bool migrated, all;
 
 	/*
@@ -2704,7 +2704,7 @@ static int kvm_vz_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 
 static int kvm_vz_vcpu_put(struct kvm_vcpu *vcpu, int cpu)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 
 	if (current->flags & PF_VCPU)
 		kvm_vz_vcpu_save_wired(vcpu);
@@ -3076,7 +3076,7 @@ static void kvm_vz_vcpu_uninit(struct kvm_vcpu *vcpu)
 
 static int kvm_vz_vcpu_setup(struct kvm_vcpu *vcpu)
 {
-	struct mips_coproc *cop0 = vcpu->arch.cop0;
+	struct mips_coproc *cop0 = &vcpu->arch.cop0;
 	unsigned long count_hz = 100*1000*1000; /* default to 100 MHz */
 
 	/*

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers
  2023-06-16  8:23     ` Thomas Bogendoerfer
@ 2023-06-16  8:31       ` Huacai Chen
  2023-06-18  7:55         ` Thomas Bogendoerfer
  2023-06-17  1:52       ` Yu Zhao
  1 sibling, 1 reply; 23+ messages in thread
From: Huacai Chen @ 2023-06-16  8:31 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Yu Zhao, aleksandar.qemu.devel, jiaxun.yang, kvm, linux-mips,
	pbonzini, robh+dt, zhangfx

On Fri, Jun 16, 2023 at 4:23 PM Thomas Bogendoerfer
<tsbogend@alpha.franken.de> wrote:
>
> On Fri, Jun 16, 2023 at 01:18:31AM -0600, Yu Zhao wrote:
> > On Tue, Jul 28, 2020 at 23:58:20PM -0700, Huacai Chen wrote:
> > > James Hogan has become inactive for a long time and leaves KVM for MIPS
> > > orphan. I'm working on KVM/Loongson and attempt to make it upstream both
> > > in kernel and QEMU, while Aleksandar Markovic is already a maintainer of
> > > QEMU/MIPS. We are both interested in QEMU/KVM/MIPS, and we have already
> > > made some contributions in kernel and QEMU. If possible, we want to take
> > > the KVM/MIPS maintainership.
> > >
> > > Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > > Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > > Signed-off-by: Huacai Chen <chenhc@lemote.com>
> > > ---
> > >  MAINTAINERS | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > index bddc79a..5f9c2fd 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -9441,9 +9441,11 @@ F:   arch/arm64/kvm/
> > >  F: include/kvm/arm_*
> > >
> > >  KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)
> > > +M: Huacai Chen <chenhc@lemote.com>
> > > +M: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > >  L: linux-mips@vger.kernel.org
> > >  L: kvm@vger.kernel.org
> > > -S: Orphan
> > > +S: Maintained
> > >  F: arch/mips/include/asm/kvm*
> > >  F: arch/mips/include/uapi/asm/kvm*
> > >  F: arch/mips/kvm/
> >
> > Hi,
> >
> > Is kvm/mips still maintained? Thanks.
> >
> > I tried v6.4-rc6 and hit the following crash. It seems it has been broken since
> >
> >   commit 45c7e8af4a5e3f0bea4ac209eea34118dd57ac64
> >   Author: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> >   Date:   Mon Mar 1 16:29:57 2021 +0100
> >
> >       MIPS: Remove KVM_TE support
>
> ok, I see what I missed when removing TE support, d'oh. Does the patch
> below fix the issue for you ?
>
> Thomas.
>
> diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
> index 957121a495f0..04cedf9f8811 100644
> --- a/arch/mips/include/asm/kvm_host.h
> +++ b/arch/mips/include/asm/kvm_host.h
> @@ -317,7 +317,7 @@ struct kvm_vcpu_arch {
>         unsigned int aux_inuse;
>
>         /* COP0 State */
> -       struct mips_coproc *cop0;
> +       struct mips_coproc cop0;
Maybe keeping it as a pointer and allocate in kvm_arch_vcpu_create()
is better? (smaller modification)

Huacai
>
>         /* Resume PC after MMIO completion */
>         unsigned long io_pc;
> @@ -698,7 +698,7 @@ static inline bool kvm_mips_guest_can_have_fpu(struct kvm_vcpu_arch *vcpu)
>  static inline bool kvm_mips_guest_has_fpu(struct kvm_vcpu_arch *vcpu)
>  {
>         return kvm_mips_guest_can_have_fpu(vcpu) &&
> -               kvm_read_c0_guest_config1(vcpu->cop0) & MIPS_CONF1_FP;
> +               kvm_read_c0_guest_config1(&vcpu->cop0) & MIPS_CONF1_FP;
>  }
>
>  static inline bool kvm_mips_guest_can_have_msa(struct kvm_vcpu_arch *vcpu)
> @@ -710,7 +710,7 @@ static inline bool kvm_mips_guest_can_have_msa(struct kvm_vcpu_arch *vcpu)
>  static inline bool kvm_mips_guest_has_msa(struct kvm_vcpu_arch *vcpu)
>  {
>         return kvm_mips_guest_can_have_msa(vcpu) &&
> -               kvm_read_c0_guest_config3(vcpu->cop0) & MIPS_CONF3_MSA;
> +               kvm_read_c0_guest_config3(&vcpu->cop0) & MIPS_CONF3_MSA;
>  }
>
>  struct kvm_mips_callbacks {
> diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
> index edaec93a1a1f..e64372b8f66a 100644
> --- a/arch/mips/kvm/emulate.c
> +++ b/arch/mips/kvm/emulate.c
> @@ -312,7 +312,7 @@ int kvm_get_badinstrp(u32 *opc, struct kvm_vcpu *vcpu, u32 *out)
>   */
>  int kvm_mips_count_disabled(struct kvm_vcpu *vcpu)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>
>         return  (vcpu->arch.count_ctl & KVM_REG_MIPS_COUNT_CTL_DC) ||
>                 (kvm_read_c0_guest_cause(cop0) & CAUSEF_DC);
> @@ -384,7 +384,7 @@ static inline ktime_t kvm_mips_count_time(struct kvm_vcpu *vcpu)
>   */
>  static u32 kvm_mips_read_count_running(struct kvm_vcpu *vcpu, ktime_t now)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         ktime_t expires, threshold;
>         u32 count, compare;
>         int running;
> @@ -444,7 +444,7 @@ static u32 kvm_mips_read_count_running(struct kvm_vcpu *vcpu, ktime_t now)
>   */
>  u32 kvm_mips_read_count(struct kvm_vcpu *vcpu)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>
>         /* If count disabled just read static copy of count */
>         if (kvm_mips_count_disabled(vcpu))
> @@ -502,7 +502,7 @@ ktime_t kvm_mips_freeze_hrtimer(struct kvm_vcpu *vcpu, u32 *count)
>  static void kvm_mips_resume_hrtimer(struct kvm_vcpu *vcpu,
>                                     ktime_t now, u32 count)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         u32 compare;
>         u64 delta;
>         ktime_t expire;
> @@ -603,7 +603,7 @@ int kvm_mips_restore_hrtimer(struct kvm_vcpu *vcpu, ktime_t before,
>   */
>  void kvm_mips_write_count(struct kvm_vcpu *vcpu, u32 count)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         ktime_t now;
>
>         /* Calculate bias */
> @@ -649,7 +649,7 @@ void kvm_mips_init_count(struct kvm_vcpu *vcpu, unsigned long count_hz)
>   */
>  int kvm_mips_set_count_hz(struct kvm_vcpu *vcpu, s64 count_hz)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         int dc;
>         ktime_t now;
>         u32 count;
> @@ -696,7 +696,7 @@ int kvm_mips_set_count_hz(struct kvm_vcpu *vcpu, s64 count_hz)
>   */
>  void kvm_mips_write_compare(struct kvm_vcpu *vcpu, u32 compare, bool ack)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         int dc;
>         u32 old_compare = kvm_read_c0_guest_compare(cop0);
>         s32 delta = compare - old_compare;
> @@ -779,7 +779,7 @@ void kvm_mips_write_compare(struct kvm_vcpu *vcpu, u32 compare, bool ack)
>   */
>  static ktime_t kvm_mips_count_disable(struct kvm_vcpu *vcpu)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         u32 count;
>         ktime_t now;
>
> @@ -806,7 +806,7 @@ static ktime_t kvm_mips_count_disable(struct kvm_vcpu *vcpu)
>   */
>  void kvm_mips_count_disable_cause(struct kvm_vcpu *vcpu)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>
>         kvm_set_c0_guest_cause(cop0, CAUSEF_DC);
>         if (!(vcpu->arch.count_ctl & KVM_REG_MIPS_COUNT_CTL_DC))
> @@ -826,7 +826,7 @@ void kvm_mips_count_disable_cause(struct kvm_vcpu *vcpu)
>   */
>  void kvm_mips_count_enable_cause(struct kvm_vcpu *vcpu)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         u32 count;
>
>         kvm_clear_c0_guest_cause(cop0, CAUSEF_DC);
> @@ -852,7 +852,7 @@ void kvm_mips_count_enable_cause(struct kvm_vcpu *vcpu)
>   */
>  int kvm_mips_set_count_ctl(struct kvm_vcpu *vcpu, s64 count_ctl)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         s64 changed = count_ctl ^ vcpu->arch.count_ctl;
>         s64 delta;
>         ktime_t expire, now;
> diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c
> index 884be4ef99dc..aa5583a7b05b 100644
> --- a/arch/mips/kvm/mips.c
> +++ b/arch/mips/kvm/mips.c
> @@ -649,7 +649,7 @@ static int kvm_mips_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices)
>  static int kvm_mips_get_reg(struct kvm_vcpu *vcpu,
>                             const struct kvm_one_reg *reg)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         struct mips_fpu_struct *fpu = &vcpu->arch.fpu;
>         int ret;
>         s64 v;
> @@ -761,7 +761,7 @@ static int kvm_mips_get_reg(struct kvm_vcpu *vcpu,
>  static int kvm_mips_set_reg(struct kvm_vcpu *vcpu,
>                             const struct kvm_one_reg *reg)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         struct mips_fpu_struct *fpu = &vcpu->arch.fpu;
>         s64 v;
>         s64 vs[2];
> @@ -1086,7 +1086,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
>  int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
>  {
>         return kvm_mips_pending_timer(vcpu) ||
> -               kvm_read_c0_guest_cause(vcpu->arch.cop0) & C_TI;
> +               kvm_read_c0_guest_cause(&vcpu->arch.cop0) & C_TI;
>  }
>
>  int kvm_arch_vcpu_dump_regs(struct kvm_vcpu *vcpu)
> @@ -1110,7 +1110,7 @@ int kvm_arch_vcpu_dump_regs(struct kvm_vcpu *vcpu)
>         kvm_debug("\thi: 0x%08lx\n", vcpu->arch.hi);
>         kvm_debug("\tlo: 0x%08lx\n", vcpu->arch.lo);
>
> -       cop0 = vcpu->arch.cop0;
> +       cop0 = &vcpu->arch.cop0;
>         kvm_debug("\tStatus: 0x%08x, Cause: 0x%08x\n",
>                   kvm_read_c0_guest_status(cop0),
>                   kvm_read_c0_guest_cause(cop0));
> @@ -1232,7 +1232,7 @@ static int __kvm_mips_handle_exit(struct kvm_vcpu *vcpu)
>
>         case EXCCODE_TLBS:
>                 kvm_debug("TLB ST fault:  cause %#x, status %#x, PC: %p, BadVaddr: %#lx\n",
> -                         cause, kvm_read_c0_guest_status(vcpu->arch.cop0), opc,
> +                         cause, kvm_read_c0_guest_status(&vcpu->arch.cop0), opc,
>                           badvaddr);
>
>                 ++vcpu->stat.tlbmiss_st_exits;
> @@ -1304,7 +1304,7 @@ static int __kvm_mips_handle_exit(struct kvm_vcpu *vcpu)
>                 kvm_get_badinstr(opc, vcpu, &inst);
>                 kvm_err("Exception Code: %d, not yet handled, @ PC: %p, inst: 0x%08x  BadVaddr: %#lx Status: %#x\n",
>                         exccode, opc, inst, badvaddr,
> -                       kvm_read_c0_guest_status(vcpu->arch.cop0));
> +                       kvm_read_c0_guest_status(&vcpu->arch.cop0));
>                 kvm_arch_vcpu_dump_regs(vcpu);
>                 run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
>                 ret = RESUME_HOST;
> @@ -1377,7 +1377,7 @@ int noinstr kvm_mips_handle_exit(struct kvm_vcpu *vcpu)
>  /* Enable FPU for guest and restore context */
>  void kvm_own_fpu(struct kvm_vcpu *vcpu)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         unsigned int sr, cfg5;
>
>         preempt_disable();
> @@ -1421,7 +1421,7 @@ void kvm_own_fpu(struct kvm_vcpu *vcpu)
>  /* Enable MSA for guest and restore context */
>  void kvm_own_msa(struct kvm_vcpu *vcpu)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         unsigned int sr, cfg5;
>
>         preempt_disable();
> diff --git a/arch/mips/kvm/vz.c b/arch/mips/kvm/vz.c
> index 3d21cbfa7443..99d5a71e4300 100644
> --- a/arch/mips/kvm/vz.c
> +++ b/arch/mips/kvm/vz.c
> @@ -422,7 +422,7 @@ static void _kvm_vz_restore_htimer(struct kvm_vcpu *vcpu,
>   */
>  static void kvm_vz_restore_timer(struct kvm_vcpu *vcpu)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         u32 cause, compare;
>
>         compare = kvm_read_sw_gc0_compare(cop0);
> @@ -517,7 +517,7 @@ static void _kvm_vz_save_htimer(struct kvm_vcpu *vcpu,
>   */
>  static void kvm_vz_save_timer(struct kvm_vcpu *vcpu)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         u32 gctl0, compare, cause;
>
>         gctl0 = read_c0_guestctl0();
> @@ -863,7 +863,7 @@ static unsigned long mips_process_maar(unsigned int op, unsigned long val)
>
>  static void kvm_write_maari(struct kvm_vcpu *vcpu, unsigned long val)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>
>         val &= MIPS_MAARI_INDEX;
>         if (val == MIPS_MAARI_INDEX)
> @@ -876,7 +876,7 @@ static enum emulation_result kvm_vz_gpsi_cop0(union mips_instruction inst,
>                                               u32 *opc, u32 cause,
>                                               struct kvm_vcpu *vcpu)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         enum emulation_result er = EMULATE_DONE;
>         u32 rt, rd, sel;
>         unsigned long curr_pc;
> @@ -1911,7 +1911,7 @@ static int kvm_vz_get_one_reg(struct kvm_vcpu *vcpu,
>                               const struct kvm_one_reg *reg,
>                               s64 *v)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         unsigned int idx;
>
>         switch (reg->id) {
> @@ -2081,7 +2081,7 @@ static int kvm_vz_get_one_reg(struct kvm_vcpu *vcpu,
>         case KVM_REG_MIPS_CP0_MAARI:
>                 if (!cpu_guest_has_maar || cpu_guest_has_dyn_maar)
>                         return -EINVAL;
> -               *v = kvm_read_sw_gc0_maari(vcpu->arch.cop0);
> +               *v = kvm_read_sw_gc0_maari(&vcpu->arch.cop0);
>                 break;
>  #ifdef CONFIG_64BIT
>         case KVM_REG_MIPS_CP0_XCONTEXT:
> @@ -2135,7 +2135,7 @@ static int kvm_vz_set_one_reg(struct kvm_vcpu *vcpu,
>                               const struct kvm_one_reg *reg,
>                               s64 v)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         unsigned int idx;
>         int ret = 0;
>         unsigned int cur, change;
> @@ -2562,7 +2562,7 @@ static void kvm_vz_vcpu_load_tlb(struct kvm_vcpu *vcpu, int cpu)
>
>  static int kvm_vz_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         bool migrated, all;
>
>         /*
> @@ -2704,7 +2704,7 @@ static int kvm_vz_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
>
>  static int kvm_vz_vcpu_put(struct kvm_vcpu *vcpu, int cpu)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>
>         if (current->flags & PF_VCPU)
>                 kvm_vz_vcpu_save_wired(vcpu);
> @@ -3076,7 +3076,7 @@ static void kvm_vz_vcpu_uninit(struct kvm_vcpu *vcpu)
>
>  static int kvm_vz_vcpu_setup(struct kvm_vcpu *vcpu)
>  {
> -       struct mips_coproc *cop0 = vcpu->arch.cop0;
> +       struct mips_coproc *cop0 = &vcpu->arch.cop0;
>         unsigned long count_hz = 100*1000*1000; /* default to 100 MHz */
>
>         /*
>
> --
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers
  2023-06-16  8:23     ` Thomas Bogendoerfer
  2023-06-16  8:31       ` Huacai Chen
@ 2023-06-17  1:52       ` Yu Zhao
  2023-06-18  2:13         ` Huacai Chen
  1 sibling, 1 reply; 23+ messages in thread
From: Yu Zhao @ 2023-06-17  1:52 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: chenhuacai, aleksandar.qemu.devel, jiaxun.yang, kvm, linux-mips,
	pbonzini, robh+dt, zhangfx

On Fri, Jun 16, 2023 at 10:23:22AM +0200, Thomas Bogendoerfer wrote:
> On Fri, Jun 16, 2023 at 01:18:31AM -0600, Yu Zhao wrote:
> > On Tue, Jul 28, 2020 at 23:58:20PM -0700, Huacai Chen wrote:
> > > James Hogan has become inactive for a long time and leaves KVM for MIPS
> > > orphan. I'm working on KVM/Loongson and attempt to make it upstream both
> > > in kernel and QEMU, while Aleksandar Markovic is already a maintainer of
> > > QEMU/MIPS. We are both interested in QEMU/KVM/MIPS, and we have already
> > > made some contributions in kernel and QEMU. If possible, we want to take
> > > the KVM/MIPS maintainership.
> > >
> > > Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > > Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > > Signed-off-by: Huacai Chen <chenhc@lemote.com>
> > > ---
> > >  MAINTAINERS | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > index bddc79a..5f9c2fd 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -9441,9 +9441,11 @@ F:	arch/arm64/kvm/
> > >  F:	include/kvm/arm_*
> > >
> > >  KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)
> > > +M:	Huacai Chen <chenhc@lemote.com>
> > > +M:	Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > >  L:	linux-mips@vger.kernel.org
> > >  L:	kvm@vger.kernel.org
> > > -S:	Orphan
> > > +S:	Maintained
> > >  F:	arch/mips/include/asm/kvm*
> > >  F:	arch/mips/include/uapi/asm/kvm*
> > >  F:	arch/mips/kvm/
> > 
> > Hi,
> > 
> > Is kvm/mips still maintained? Thanks.
> > 
> > I tried v6.4-rc6 and hit the following crash. It seems it has been broken since
> > 
> >   commit 45c7e8af4a5e3f0bea4ac209eea34118dd57ac64
> >   Author: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> >   Date:   Mon Mar 1 16:29:57 2021 +0100
> >   
> >       MIPS: Remove KVM_TE support
> 
> ok, I see what I missed when removing TE support, d'oh. Does the patch
> below fix the issue for you ?

Thanks!

It made some progress but somehow crashed the guest kernel.

$ qemu-system-mips64el --version
QEMU emulator version 7.2.2 (Debian 1:7.2+dfsg-7)
Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers

# w/o KVM

  # malta: working (but slow)

    $ qemu-system-mips64el -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
    [    0.000000] Linux version 4.9.58 (buildbot@builds) (gcc version 5.5.0 (LEDE GCC 5.5.0 r5218-f90f94d) ) #0 SMP Wed Nov 1 21:08:14 2017
    ...

  # loongson3-virt: hanged

    $ qemu-system-mips64el -M loongson3-virt -m 512m -nographic -kernel vmlinuz-6.1.0-9-loongson-3 -initrd initrd.gz
    [    0.000000] Linux version 6.1.0-9-loongson-3 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT Debian 6.1.27-1 (2023-05-08)
    ...
    [    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000009fffffff]

# w/ KVM

  # malta: qemu error

    $ sudo qemu-system-mips64el -M accel=kvm -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
    qemu-system-mips64el: KVM guest kernels must be linked in useg. Did you forget to enable CONFIG_KVM_GUEST?

  # loongson3-virt: qemu error

    $ sudo qemu-system-mips64el -M loongson3-virt,accel=kvm -m 512m -nographic -kernel vmlinuz-6.1.0-9-loongson-3 -initrd initrd.gz
    qemu-system-mips64el: ../../accel/kvm/kvm-all.c:2310: kvm_init: Assertion `TARGET_PAGE_SIZE <= qemu_real_host_page_size()' failed.
    Aborted

$ qemu-system-mips64el --version
QEMU emulator version 8.0.2 (Debian 1:8.0.2+dfsg-1)
Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers

# w/o KVM

  # malta: no change
  # loongson3-virt: no change

# w/ KVM

  # loongson3-virt: the same qemu error

  # malta: booted very fast but guest crashed:

$ sudo qemu-system-mips64el -M accel=kvm -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
[    0.000000] Linux version 4.9.58 (buildbot@builds) (gcc version 5.5.0 (LEDE GCC 5.5.0 r5218-f90f94d) ) #0 SMP Wed Nov 1 21:08:14 2017
[    0.000000] earlycon: uart8250 at I/O port 0x3f8 (options '38400n8')
[    0.000000] bootconsole [uart8250] enabled
[    0.000000] Config serial console: console=ttyS0,38400n8r
[    0.000000] CPU0 revision is: 000d9602 (Cavium Octeon III)
[    0.000000] FPU revision is: 00739600
[    0.000000] Checking for the multiply/shift bug... [    0.000000] no.
[    0.000000] Checking for the daddiu bug... [    0.000000] no.
[    0.000000] MIPS: machine is mti,malta
[    0.000000] Software DMA cache coherency enabled
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 0000000008000000 @ 0000000000000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 16kB, VIVT, 8-way, linesize 128 bytes.
[    0.000000] Primary data cache 8kB, 8-way, VIPT, no aliases, linesize 128 bytes
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000000000-0x0000000000ffffff]
[    0.000000]   DMA32    [mem 0x0000000001000000-0x00000000ffffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] percpu: Embedded 18 pages/cpu @80000000011c5000 s33120 r8192 d32416 u73728
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32320
[    0.000000] Kernel command line:  console=ttyS0,38400n8r
[    0.000000] PID hash table entries: 512 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
[    0.000000] Memory: 114464K/131072K available (4299K kernel code, 322K rwdata, 1168K rodata, 7368K init, 295K bss, 16608K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  CONFIG_RCU_FANOUT set to non-default value of 32
[    0.000000]  RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS:256
[    0.000000] CPU frequency 1999.99 MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911270662 ns
[    0.000007] sched_clock: 32 bits at 999MHz, resolution 1ns, wraps every 2147494911ns
[    0.003394] Console: colour dummy device 80x25
[    0.004942] Calibrating delay loop... 653.72 BogoMIPS (lpj=3268608)
[    0.276221] pid_max: default: 32768 minimum: 301
[    0.277862] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.280038] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.284299] Checking for the daddi bug... [    0.286094] no.
[    0.289633] Brought up 1 CPUs
[    0.292878] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.296595] futex hash table entries: 256 (order: 2, 16384 bytes)
[    0.299743] CPU 0 Unable to handle kernel paging request at virtual address c000000000002002, epc == ffffffff804445d4, ra == ffffffff80444cb8
[    0.303942] Oops[#1]:
[    0.304738] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.58 #0
[    0.307060] task: 8000000007c58000 task.stack: 8000000007c54000
[    0.309171] $ 0   : 0000000000000000 0000000000000000 0000000000000042 80000000011cf1a8
[    0.312027] $ 4   : c000000000002000 0000000000000000 0000000000000000 0000000000000001
[    0.314882] $ 8   : 0000000000000006 c000000000002238 0000000e00000030 0000000800000054
[    0.317913] $12   : 0000000004000015 ffffffff80326c1c 0000000000000000 0000000e00000028
[    0.320774] $16   : c000000000002000 0000000000000210 8000000007c57d90 ffffffff8067b730
[    0.323622] $20   : ffffffff80680000 ffffffff806e5298 ffffffff806ae2b0 ffffffff80de0000
[    0.326675] $24   : 0000000000000000 ffffffff8016036c
[    0.329539] $28   : 8000000007c54000 8000000007c57cf0 ffffffff80de0000 ffffffff80444cb8
[    0.332388] Hi    : 0000000000000000
[    0.333656] Lo    : 00000000001b4760
[    0.335001] epc   : ffffffff804445d4 bpf_prepare_filter+0x2c/0x674
[    0.337394] ra    : ffffffff80444cb8 bpf_prog_create+0x9c/0xdc
[    0.339461] Status: 140027e3 KX SX UX KERNEL EXL IE
[    0.341260] Cause : 0080004c (ExcCode 13)
[    0.342683] PrId  : 000d9602 (Cavium Octeon III)
[    0.344321] Modules linked in:
[    0.345617] Process swapper/0 (pid: 1, threadinfo=8000000007c54000, task=8000000007c58000, tls=0000000000000000)
[    0.349216] Stack : ffffffff806ae2b0 c000000000002000 00000000024080c2 0000000000001000
[    0.352066]         c000000000002000 0000000000000210 8000000007c57d90 ffffffff8067b730
[    0.354914]         ffffffff80680000 ffffffff806e5298 ffffffff806ae2b0 ffffffff80de0000
[    0.357959]         ffffffff80de0000 ffffffff80444cb8 ffffffff80680000 0000000000000000
[    0.360809]         ffffffff806a0000 0000000000000000 ffffffff806d4848 ffffffff806cce20
[    0.363664]         ffffffff80680042 ffffffff806dfdb0 ffffffff806a0000 ffffffff806cc1b0
[    0.366714]         ffffffff80680000 ffffffff80680000 ffffffff806cc108 ffffffff80100608
[    0.369591]         0000000000000001 0000000000000000 0000000000000000 ffffffff80555660
[    0.372440]         ffffffff805f6338 ffffffff805f0000 0000000000000061 0000000000000002
[    0.375490]         ffffffff806d4888 000000000004093a 0000000000000061 0000000000000002
[    0.378343]         ...
[    0.379220] Call Trace:
[    0.380111] [<ffffffff804445d4>] bpf_prepare_filter+0x2c/0x674
[    0.382177] [<ffffffff80444cb8>] bpf_prog_create+0x9c/0xdc
[    0.384160] [<ffffffff806cce20>] ptp_classifier_init+0x2c/0x3c
[    0.386465] [<ffffffff806cc1b0>] sock_init+0xa8/0xc0
[    0.388276] [<ffffffff80100608>] do_one_initcall+0xa8/0x180
[    0.390289] [<ffffffff806aede0>] kernel_init_freeable+0x180/0x234
[    0.392482] [<ffffffff8052aa38>] kernel_init+0x10/0x10c
[    0.394372] [<ffffffff801062e8>] ret_from_kernel_thread+0x14/0x1c
[    0.396780] Code: ffb10028  ffb00020  ffbe0060 <90820002> 00808025  304200fe  a0820002  fc800020  64920028
[    0.400307]
[    0.401013] ---[ end trace 7278246801a7bc60 ]---
[    0.402570] Kernel panic - not syncing: Fatal exception
[    0.404311] Rebooting in 1 seconds..
[    2.385408] Reboot failed -- System halted

openwrt/malta: https://downloads.openwrt.org/snapshots/targets/malta/le64/
debian/loongson-3: https://deb.debian.org/debian/dists/sid/main/installer-mips64el/current/images/
debian/malta: not working

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers
  2023-06-17  1:52       ` Yu Zhao
@ 2023-06-18  2:13         ` Huacai Chen
  2023-06-18  2:51           ` Yu Zhao
  0 siblings, 1 reply; 23+ messages in thread
From: Huacai Chen @ 2023-06-18  2:13 UTC (permalink / raw)
  To: Yu Zhao
  Cc: Thomas Bogendoerfer, jiaxun.yang, kvm, linux-mips, pbonzini, robh+dt

Hi, Zhao,

I have reproduced the problem, and I hope I can fix it in a few days,
of course you can also try to do that. :)

Huacai

On Sat, Jun 17, 2023 at 9:52 AM Yu Zhao <yuzhao@google.com> wrote:
>
> On Fri, Jun 16, 2023 at 10:23:22AM +0200, Thomas Bogendoerfer wrote:
> > On Fri, Jun 16, 2023 at 01:18:31AM -0600, Yu Zhao wrote:
> > > On Tue, Jul 28, 2020 at 23:58:20PM -0700, Huacai Chen wrote:
> > > > James Hogan has become inactive for a long time and leaves KVM for MIPS
> > > > orphan. I'm working on KVM/Loongson and attempt to make it upstream both
> > > > in kernel and QEMU, while Aleksandar Markovic is already a maintainer of
> > > > QEMU/MIPS. We are both interested in QEMU/KVM/MIPS, and we have already
> > > > made some contributions in kernel and QEMU. If possible, we want to take
> > > > the KVM/MIPS maintainership.
> > > >
> > > > Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > > > Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > > > Signed-off-by: Huacai Chen <chenhc@lemote.com>
> > > > ---
> > > >  MAINTAINERS | 4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > > index bddc79a..5f9c2fd 100644
> > > > --- a/MAINTAINERS
> > > > +++ b/MAINTAINERS
> > > > @@ -9441,9 +9441,11 @@ F: arch/arm64/kvm/
> > > >  F:       include/kvm/arm_*
> > > >
> > > >  KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)
> > > > +M:       Huacai Chen <chenhc@lemote.com>
> > > > +M:       Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > > >  L:       linux-mips@vger.kernel.org
> > > >  L:       kvm@vger.kernel.org
> > > > -S:       Orphan
> > > > +S:       Maintained
> > > >  F:       arch/mips/include/asm/kvm*
> > > >  F:       arch/mips/include/uapi/asm/kvm*
> > > >  F:       arch/mips/kvm/
> > >
> > > Hi,
> > >
> > > Is kvm/mips still maintained? Thanks.
> > >
> > > I tried v6.4-rc6 and hit the following crash. It seems it has been broken since
> > >
> > >   commit 45c7e8af4a5e3f0bea4ac209eea34118dd57ac64
> > >   Author: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > >   Date:   Mon Mar 1 16:29:57 2021 +0100
> > >
> > >       MIPS: Remove KVM_TE support
> >
> > ok, I see what I missed when removing TE support, d'oh. Does the patch
> > below fix the issue for you ?
>
> Thanks!
>
> It made some progress but somehow crashed the guest kernel.
>
> $ qemu-system-mips64el --version
> QEMU emulator version 7.2.2 (Debian 1:7.2+dfsg-7)
> Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
>
> # w/o KVM
>
>   # malta: working (but slow)
>
>     $ qemu-system-mips64el -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
>     [    0.000000] Linux version 4.9.58 (buildbot@builds) (gcc version 5.5.0 (LEDE GCC 5.5.0 r5218-f90f94d) ) #0 SMP Wed Nov 1 21:08:14 2017
>     ...
>
>   # loongson3-virt: hanged
>
>     $ qemu-system-mips64el -M loongson3-virt -m 512m -nographic -kernel vmlinuz-6.1.0-9-loongson-3 -initrd initrd.gz
>     [    0.000000] Linux version 6.1.0-9-loongson-3 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT Debian 6.1.27-1 (2023-05-08)
>     ...
>     [    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000009fffffff]
>
> # w/ KVM
>
>   # malta: qemu error
>
>     $ sudo qemu-system-mips64el -M accel=kvm -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
>     qemu-system-mips64el: KVM guest kernels must be linked in useg. Did you forget to enable CONFIG_KVM_GUEST?
>
>   # loongson3-virt: qemu error
>
>     $ sudo qemu-system-mips64el -M loongson3-virt,accel=kvm -m 512m -nographic -kernel vmlinuz-6.1.0-9-loongson-3 -initrd initrd.gz
>     qemu-system-mips64el: ../../accel/kvm/kvm-all.c:2310: kvm_init: Assertion `TARGET_PAGE_SIZE <= qemu_real_host_page_size()' failed.
>     Aborted
>
> $ qemu-system-mips64el --version
> QEMU emulator version 8.0.2 (Debian 1:8.0.2+dfsg-1)
> Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
>
> # w/o KVM
>
>   # malta: no change
>   # loongson3-virt: no change
>
> # w/ KVM
>
>   # loongson3-virt: the same qemu error
>
>   # malta: booted very fast but guest crashed:
>
> $ sudo qemu-system-mips64el -M accel=kvm -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
> [    0.000000] Linux version 4.9.58 (buildbot@builds) (gcc version 5.5.0 (LEDE GCC 5.5.0 r5218-f90f94d) ) #0 SMP Wed Nov 1 21:08:14 2017
> [    0.000000] earlycon: uart8250 at I/O port 0x3f8 (options '38400n8')
> [    0.000000] bootconsole [uart8250] enabled
> [    0.000000] Config serial console: console=ttyS0,38400n8r
> [    0.000000] CPU0 revision is: 000d9602 (Cavium Octeon III)
> [    0.000000] FPU revision is: 00739600
> [    0.000000] Checking for the multiply/shift bug... [    0.000000] no.
> [    0.000000] Checking for the daddiu bug... [    0.000000] no.
> [    0.000000] MIPS: machine is mti,malta
> [    0.000000] Software DMA cache coherency enabled
> [    0.000000] Determined physical RAM map:
> [    0.000000]  memory: 0000000008000000 @ 0000000000000000 (usable)
> [    0.000000] Initrd not found or empty - disabling initrd
> [    0.000000] Primary instruction cache 16kB, VIVT, 8-way, linesize 128 bytes.
> [    0.000000] Primary data cache 8kB, 8-way, VIPT, no aliases, linesize 128 bytes
> [    0.000000] Zone ranges:
> [    0.000000]   DMA      [mem 0x0000000000000000-0x0000000000ffffff]
> [    0.000000]   DMA32    [mem 0x0000000001000000-0x00000000ffffffff]
> [    0.000000]   Normal   empty
> [    0.000000] Movable zone start for each node
> [    0.000000] Early memory node ranges
> [    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
> [    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
> [    0.000000] percpu: Embedded 18 pages/cpu @80000000011c5000 s33120 r8192 d32416 u73728
> [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32320
> [    0.000000] Kernel command line:  console=ttyS0,38400n8r
> [    0.000000] PID hash table entries: 512 (order: 0, 4096 bytes)
> [    0.000000] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
> [    0.000000] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
> [    0.000000] Memory: 114464K/131072K available (4299K kernel code, 322K rwdata, 1168K rodata, 7368K init, 295K bss, 16608K reserved, 0K cma-reserved)
> [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
> [    0.000000] Hierarchical RCU implementation.
> [    0.000000]  CONFIG_RCU_FANOUT set to non-default value of 32
> [    0.000000]  RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
> [    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
> [    0.000000] NR_IRQS:256
> [    0.000000] CPU frequency 1999.99 MHz
> [    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911270662 ns
> [    0.000007] sched_clock: 32 bits at 999MHz, resolution 1ns, wraps every 2147494911ns
> [    0.003394] Console: colour dummy device 80x25
> [    0.004942] Calibrating delay loop... 653.72 BogoMIPS (lpj=3268608)
> [    0.276221] pid_max: default: 32768 minimum: 301
> [    0.277862] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
> [    0.280038] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
> [    0.284299] Checking for the daddi bug... [    0.286094] no.
> [    0.289633] Brought up 1 CPUs
> [    0.292878] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
> [    0.296595] futex hash table entries: 256 (order: 2, 16384 bytes)
> [    0.299743] CPU 0 Unable to handle kernel paging request at virtual address c000000000002002, epc == ffffffff804445d4, ra == ffffffff80444cb8
> [    0.303942] Oops[#1]:
> [    0.304738] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.58 #0
> [    0.307060] task: 8000000007c58000 task.stack: 8000000007c54000
> [    0.309171] $ 0   : 0000000000000000 0000000000000000 0000000000000042 80000000011cf1a8
> [    0.312027] $ 4   : c000000000002000 0000000000000000 0000000000000000 0000000000000001
> [    0.314882] $ 8   : 0000000000000006 c000000000002238 0000000e00000030 0000000800000054
> [    0.317913] $12   : 0000000004000015 ffffffff80326c1c 0000000000000000 0000000e00000028
> [    0.320774] $16   : c000000000002000 0000000000000210 8000000007c57d90 ffffffff8067b730
> [    0.323622] $20   : ffffffff80680000 ffffffff806e5298 ffffffff806ae2b0 ffffffff80de0000
> [    0.326675] $24   : 0000000000000000 ffffffff8016036c
> [    0.329539] $28   : 8000000007c54000 8000000007c57cf0 ffffffff80de0000 ffffffff80444cb8
> [    0.332388] Hi    : 0000000000000000
> [    0.333656] Lo    : 00000000001b4760
> [    0.335001] epc   : ffffffff804445d4 bpf_prepare_filter+0x2c/0x674
> [    0.337394] ra    : ffffffff80444cb8 bpf_prog_create+0x9c/0xdc
> [    0.339461] Status: 140027e3 KX SX UX KERNEL EXL IE
> [    0.341260] Cause : 0080004c (ExcCode 13)
> [    0.342683] PrId  : 000d9602 (Cavium Octeon III)
> [    0.344321] Modules linked in:
> [    0.345617] Process swapper/0 (pid: 1, threadinfo=8000000007c54000, task=8000000007c58000, tls=0000000000000000)
> [    0.349216] Stack : ffffffff806ae2b0 c000000000002000 00000000024080c2 0000000000001000
> [    0.352066]         c000000000002000 0000000000000210 8000000007c57d90 ffffffff8067b730
> [    0.354914]         ffffffff80680000 ffffffff806e5298 ffffffff806ae2b0 ffffffff80de0000
> [    0.357959]         ffffffff80de0000 ffffffff80444cb8 ffffffff80680000 0000000000000000
> [    0.360809]         ffffffff806a0000 0000000000000000 ffffffff806d4848 ffffffff806cce20
> [    0.363664]         ffffffff80680042 ffffffff806dfdb0 ffffffff806a0000 ffffffff806cc1b0
> [    0.366714]         ffffffff80680000 ffffffff80680000 ffffffff806cc108 ffffffff80100608
> [    0.369591]         0000000000000001 0000000000000000 0000000000000000 ffffffff80555660
> [    0.372440]         ffffffff805f6338 ffffffff805f0000 0000000000000061 0000000000000002
> [    0.375490]         ffffffff806d4888 000000000004093a 0000000000000061 0000000000000002
> [    0.378343]         ...
> [    0.379220] Call Trace:
> [    0.380111] [<ffffffff804445d4>] bpf_prepare_filter+0x2c/0x674
> [    0.382177] [<ffffffff80444cb8>] bpf_prog_create+0x9c/0xdc
> [    0.384160] [<ffffffff806cce20>] ptp_classifier_init+0x2c/0x3c
> [    0.386465] [<ffffffff806cc1b0>] sock_init+0xa8/0xc0
> [    0.388276] [<ffffffff80100608>] do_one_initcall+0xa8/0x180
> [    0.390289] [<ffffffff806aede0>] kernel_init_freeable+0x180/0x234
> [    0.392482] [<ffffffff8052aa38>] kernel_init+0x10/0x10c
> [    0.394372] [<ffffffff801062e8>] ret_from_kernel_thread+0x14/0x1c
> [    0.396780] Code: ffb10028  ffb00020  ffbe0060 <90820002> 00808025  304200fe  a0820002  fc800020  64920028
> [    0.400307]
> [    0.401013] ---[ end trace 7278246801a7bc60 ]---
> [    0.402570] Kernel panic - not syncing: Fatal exception
> [    0.404311] Rebooting in 1 seconds..
> [    2.385408] Reboot failed -- System halted
>
> openwrt/malta: https://downloads.openwrt.org/snapshots/targets/malta/le64/
> debian/loongson-3: https://deb.debian.org/debian/dists/sid/main/installer-mips64el/current/images/
> debian/malta: not working

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers
  2023-06-18  2:13         ` Huacai Chen
@ 2023-06-18  2:51           ` Yu Zhao
  2023-06-26  8:00             ` Huacai Chen
  0 siblings, 1 reply; 23+ messages in thread
From: Yu Zhao @ 2023-06-18  2:51 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Thomas Bogendoerfer, jiaxun.yang, kvm, linux-mips, pbonzini, robh+dt

On Sat, Jun 17, 2023 at 8:13 PM Huacai Chen <chenhuacai@kernel.org> wrote:
>
> On Sat, Jun 17, 2023 at 9:52 AM Yu Zhao <yuzhao@google.com> wrote:
> >
> > On Fri, Jun 16, 2023 at 10:23:22AM +0200, Thomas Bogendoerfer wrote:
> > > On Fri, Jun 16, 2023 at 01:18:31AM -0600, Yu Zhao wrote:
> > > > On Tue, Jul 28, 2020 at 23:58:20PM -0700, Huacai Chen wrote:
> > > > > James Hogan has become inactive for a long time and leaves KVM for MIPS
> > > > > orphan. I'm working on KVM/Loongson and attempt to make it upstream both
> > > > > in kernel and QEMU, while Aleksandar Markovic is already a maintainer of
> > > > > QEMU/MIPS. We are both interested in QEMU/KVM/MIPS, and we have already
> > > > > made some contributions in kernel and QEMU. If possible, we want to take
> > > > > the KVM/MIPS maintainership.
> > > > >
> > > > > Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > > > > Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > > > > Signed-off-by: Huacai Chen <chenhc@lemote.com>
> > > > > ---
> > > > >  MAINTAINERS | 4 +++-
> > > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > > > index bddc79a..5f9c2fd 100644
> > > > > --- a/MAINTAINERS
> > > > > +++ b/MAINTAINERS
> > > > > @@ -9441,9 +9441,11 @@ F: arch/arm64/kvm/
> > > > >  F:       include/kvm/arm_*
> > > > >
> > > > >  KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)
> > > > > +M:       Huacai Chen <chenhc@lemote.com>
> > > > > +M:       Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > > > >  L:       linux-mips@vger.kernel.org
> > > > >  L:       kvm@vger.kernel.org
> > > > > -S:       Orphan
> > > > > +S:       Maintained
> > > > >  F:       arch/mips/include/asm/kvm*
> > > > >  F:       arch/mips/include/uapi/asm/kvm*
> > > > >  F:       arch/mips/kvm/
> > > >
> > > > Hi,
> > > >
> > > > Is kvm/mips still maintained? Thanks.
> > > >
> > > > I tried v6.4-rc6 and hit the following crash. It seems it has been broken since
> > > >
> > > >   commit 45c7e8af4a5e3f0bea4ac209eea34118dd57ac64
> > > >   Author: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > > >   Date:   Mon Mar 1 16:29:57 2021 +0100
> > > >
> > > >       MIPS: Remove KVM_TE support
> > >
> > > ok, I see what I missed when removing TE support, d'oh. Does the patch
> > > below fix the issue for you ?
> >
> > Thanks!
> >
> > It made some progress but somehow crashed the guest kernel.
> >
> > $ qemu-system-mips64el --version
> > QEMU emulator version 7.2.2 (Debian 1:7.2+dfsg-7)
> > Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
> >
> > # w/o KVM
> >
> >   # malta: working (but slow)
> >
> >     $ qemu-system-mips64el -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
> >     [    0.000000] Linux version 4.9.58 (buildbot@builds) (gcc version 5.5.0 (LEDE GCC 5.5.0 r5218-f90f94d) ) #0 SMP Wed Nov 1 21:08:14 2017
> >     ...
> >
> >   # loongson3-virt: hanged
> >
> >     $ qemu-system-mips64el -M loongson3-virt -m 512m -nographic -kernel vmlinuz-6.1.0-9-loongson-3 -initrd initrd.gz
> >     [    0.000000] Linux version 6.1.0-9-loongson-3 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT Debian 6.1.27-1 (2023-05-08)
> >     ...
> >     [    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000009fffffff]
> >
> > # w/ KVM
> >
> >   # malta: qemu error
> >
> >     $ sudo qemu-system-mips64el -M accel=kvm -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
> >     qemu-system-mips64el: KVM guest kernels must be linked in useg. Did you forget to enable CONFIG_KVM_GUEST?
> >
> >   # loongson3-virt: qemu error
> >
> >     $ sudo qemu-system-mips64el -M loongson3-virt,accel=kvm -m 512m -nographic -kernel vmlinuz-6.1.0-9-loongson-3 -initrd initrd.gz
> >     qemu-system-mips64el: ../../accel/kvm/kvm-all.c:2310: kvm_init: Assertion `TARGET_PAGE_SIZE <= qemu_real_host_page_size()' failed.
> >     Aborted
> >
> > $ qemu-system-mips64el --version
> > QEMU emulator version 8.0.2 (Debian 1:8.0.2+dfsg-1)
> > Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
> >
> > # w/o KVM
> >
> >   # malta: no change
> >   # loongson3-virt: no change
> >
> > # w/ KVM
> >
> >   # loongson3-virt: the same qemu error
> >
> >   # malta: booted very fast but guest crashed:
> >
> > $ sudo qemu-system-mips64el -M accel=kvm -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
> > [    0.000000] Linux version 4.9.58 (buildbot@builds) (gcc version 5.5.0 (LEDE GCC 5.5.0 r5218-f90f94d) ) #0 SMP Wed Nov 1 21:08:14 2017

...

> > [    0.402570] Kernel panic - not syncing: Fatal exception
> > [    0.404311] Rebooting in 1 seconds..
> > [    2.385408] Reboot failed -- System halted
> >
> > openwrt/malta: https://downloads.openwrt.org/snapshots/targets/malta/le64/
> > debian/loongson-3: https://deb.debian.org/debian/dists/sid/main/installer-mips64el/current/images/
> > debian/malta: not working
>
> I have reproduced the problem, and I hope I can fix it in a few days,

That's great. Thanks a lot!

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers
  2023-06-16  8:31       ` Huacai Chen
@ 2023-06-18  7:55         ` Thomas Bogendoerfer
  0 siblings, 0 replies; 23+ messages in thread
From: Thomas Bogendoerfer @ 2023-06-18  7:55 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Yu Zhao, aleksandar.qemu.devel, jiaxun.yang, kvm, linux-mips,
	pbonzini, robh+dt, zhangfx

On Fri, Jun 16, 2023 at 04:31:13PM +0800, Huacai Chen wrote:
> On Fri, Jun 16, 2023 at 4:23 PM Thomas Bogendoerfer
> <tsbogend@alpha.franken.de> wrote:
> >
> > index 957121a495f0..04cedf9f8811 100644
> > --- a/arch/mips/include/asm/kvm_host.h
> > +++ b/arch/mips/include/asm/kvm_host.h
> > @@ -317,7 +317,7 @@ struct kvm_vcpu_arch {
> >         unsigned int aux_inuse;
> >
> >         /* COP0 State */
> > -       struct mips_coproc *cop0;
> > +       struct mips_coproc cop0;
> Maybe keeping it as a pointer and allocate in kvm_arch_vcpu_create()
> is better? (smaller modification)

I thought about it, but then we have another dynmic object, which we
need to care about lifetime. And I don't think we need *cop any longer,
so this cleanes up the code and makes it even slightly faster.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers
  2023-06-18  2:51           ` Yu Zhao
@ 2023-06-26  8:00             ` Huacai Chen
  2023-06-27 18:58               ` Yu Zhao
  0 siblings, 1 reply; 23+ messages in thread
From: Huacai Chen @ 2023-06-26  8:00 UTC (permalink / raw)
  To: Yu Zhao
  Cc: Thomas Bogendoerfer, jiaxun.yang, kvm, linux-mips, pbonzini, robh+dt

Hi, Zhao,

On Sun, Jun 18, 2023 at 10:51 AM Yu Zhao <yuzhao@google.com> wrote:
>
> On Sat, Jun 17, 2023 at 8:13 PM Huacai Chen <chenhuacai@kernel.org> wrote:
> >
> > On Sat, Jun 17, 2023 at 9:52 AM Yu Zhao <yuzhao@google.com> wrote:
> > >
> > > On Fri, Jun 16, 2023 at 10:23:22AM +0200, Thomas Bogendoerfer wrote:
> > > > On Fri, Jun 16, 2023 at 01:18:31AM -0600, Yu Zhao wrote:
> > > > > On Tue, Jul 28, 2020 at 23:58:20PM -0700, Huacai Chen wrote:
> > > > > > James Hogan has become inactive for a long time and leaves KVM for MIPS
> > > > > > orphan. I'm working on KVM/Loongson and attempt to make it upstream both
> > > > > > in kernel and QEMU, while Aleksandar Markovic is already a maintainer of
> > > > > > QEMU/MIPS. We are both interested in QEMU/KVM/MIPS, and we have already
> > > > > > made some contributions in kernel and QEMU. If possible, we want to take
> > > > > > the KVM/MIPS maintainership.
> > > > > >
> > > > > > Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > > > > > Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > > > > > Signed-off-by: Huacai Chen <chenhc@lemote.com>
> > > > > > ---
> > > > > >  MAINTAINERS | 4 +++-
> > > > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > > > > index bddc79a..5f9c2fd 100644
> > > > > > --- a/MAINTAINERS
> > > > > > +++ b/MAINTAINERS
> > > > > > @@ -9441,9 +9441,11 @@ F: arch/arm64/kvm/
> > > > > >  F:       include/kvm/arm_*
> > > > > >
> > > > > >  KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)
> > > > > > +M:       Huacai Chen <chenhc@lemote.com>
> > > > > > +M:       Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > > > > >  L:       linux-mips@vger.kernel.org
> > > > > >  L:       kvm@vger.kernel.org
> > > > > > -S:       Orphan
> > > > > > +S:       Maintained
> > > > > >  F:       arch/mips/include/asm/kvm*
> > > > > >  F:       arch/mips/include/uapi/asm/kvm*
> > > > > >  F:       arch/mips/kvm/
> > > > >
> > > > > Hi,
> > > > >
> > > > > Is kvm/mips still maintained? Thanks.
> > > > >
> > > > > I tried v6.4-rc6 and hit the following crash. It seems it has been broken since
> > > > >
> > > > >   commit 45c7e8af4a5e3f0bea4ac209eea34118dd57ac64
> > > > >   Author: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > > > >   Date:   Mon Mar 1 16:29:57 2021 +0100
> > > > >
> > > > >       MIPS: Remove KVM_TE support
> > > >
> > > > ok, I see what I missed when removing TE support, d'oh. Does the patch
> > > > below fix the issue for you ?
> > >
> > > Thanks!
> > >
> > > It made some progress but somehow crashed the guest kernel.
> > >
> > > $ qemu-system-mips64el --version
> > > QEMU emulator version 7.2.2 (Debian 1:7.2+dfsg-7)
> > > Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
> > >
> > > # w/o KVM
> > >
> > >   # malta: working (but slow)
> > >
> > >     $ qemu-system-mips64el -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
> > >     [    0.000000] Linux version 4.9.58 (buildbot@builds) (gcc version 5.5.0 (LEDE GCC 5.5.0 r5218-f90f94d) ) #0 SMP Wed Nov 1 21:08:14 2017
> > >     ...
> > >
> > >   # loongson3-virt: hanged
> > >
> > >     $ qemu-system-mips64el -M loongson3-virt -m 512m -nographic -kernel vmlinuz-6.1.0-9-loongson-3 -initrd initrd.gz
> > >     [    0.000000] Linux version 6.1.0-9-loongson-3 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT Debian 6.1.27-1 (2023-05-08)
> > >     ...
> > >     [    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000009fffffff]
> > >
> > > # w/ KVM
> > >
> > >   # malta: qemu error
> > >
> > >     $ sudo qemu-system-mips64el -M accel=kvm -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
> > >     qemu-system-mips64el: KVM guest kernels must be linked in useg. Did you forget to enable CONFIG_KVM_GUEST?
> > >
> > >   # loongson3-virt: qemu error
> > >
> > >     $ sudo qemu-system-mips64el -M loongson3-virt,accel=kvm -m 512m -nographic -kernel vmlinuz-6.1.0-9-loongson-3 -initrd initrd.gz
> > >     qemu-system-mips64el: ../../accel/kvm/kvm-all.c:2310: kvm_init: Assertion `TARGET_PAGE_SIZE <= qemu_real_host_page_size()' failed.
> > >     Aborted
> > >
> > > $ qemu-system-mips64el --version
> > > QEMU emulator version 8.0.2 (Debian 1:8.0.2+dfsg-1)
> > > Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
> > >
> > > # w/o KVM
> > >
> > >   # malta: no change
> > >   # loongson3-virt: no change
> > >
> > > # w/ KVM
> > >
> > >   # loongson3-virt: the same qemu error
> > >
> > >   # malta: booted very fast but guest crashed:
> > >
> > > $ sudo qemu-system-mips64el -M accel=kvm -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
> > > [    0.000000] Linux version 4.9.58 (buildbot@builds) (gcc version 5.5.0 (LEDE GCC 5.5.0 r5218-f90f94d) ) #0 SMP Wed Nov 1 21:08:14 2017
>
> ...
>
> > > [    0.402570] Kernel panic - not syncing: Fatal exception
> > > [    0.404311] Rebooting in 1 seconds..
> > > [    2.385408] Reboot failed -- System halted
> > >
> > > openwrt/malta: https://downloads.openwrt.org/snapshots/targets/malta/le64/
> > > debian/loongson-3: https://deb.debian.org/debian/dists/sid/main/installer-mips64el/current/images/
> > > debian/malta: not working
> >
> > I have reproduced the problem, and I hope I can fix it in a few days,
>
> That's great. Thanks a lot!
I fixed the KVM problems on Loongson [1][2][3]. However, you have
tried [1] but still have problems, while [2] and [3] are specific to
Loongson, so maybe you are still unable to use KVM.

[1] https://lore.kernel.org/linux-mips/20230626074919.1871944-1-chenhuacai@loongson.cn/T/#u
[2] https://lore.kernel.org/linux-mips/20230626075014.1872632-1-chenhuacai@loongson.cn/T/#u
[3] https://lore.kernel.org/linux-mips/20230626075047.1872818-1-chenhuacai@loongson.cn/T/#u

Huacai

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers
  2023-06-26  8:00             ` Huacai Chen
@ 2023-06-27 18:58               ` Yu Zhao
  0 siblings, 0 replies; 23+ messages in thread
From: Yu Zhao @ 2023-06-27 18:58 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Thomas Bogendoerfer, jiaxun.yang, kvm, linux-mips, pbonzini, robh+dt

On Mon, Jun 26, 2023 at 2:00 AM Huacai Chen <chenhuacai@kernel.org> wrote:
>
> Hi, Zhao,
>
> On Sun, Jun 18, 2023 at 10:51 AM Yu Zhao <yuzhao@google.com> wrote:
> >
> > On Sat, Jun 17, 2023 at 8:13 PM Huacai Chen <chenhuacai@kernel.org> wrote:
> > >
> > > On Sat, Jun 17, 2023 at 9:52 AM Yu Zhao <yuzhao@google.com> wrote:
> > > >
> > > > On Fri, Jun 16, 2023 at 10:23:22AM +0200, Thomas Bogendoerfer wrote:
> > > > > On Fri, Jun 16, 2023 at 01:18:31AM -0600, Yu Zhao wrote:
> > > > > > On Tue, Jul 28, 2020 at 23:58:20PM -0700, Huacai Chen wrote:
> > > > > > > James Hogan has become inactive for a long time and leaves KVM for MIPS
> > > > > > > orphan. I'm working on KVM/Loongson and attempt to make it upstream both
> > > > > > > in kernel and QEMU, while Aleksandar Markovic is already a maintainer of
> > > > > > > QEMU/MIPS. We are both interested in QEMU/KVM/MIPS, and we have already
> > > > > > > made some contributions in kernel and QEMU. If possible, we want to take
> > > > > > > the KVM/MIPS maintainership.
> > > > > > >
> > > > > > > Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > > > > > > Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > > > > > > Signed-off-by: Huacai Chen <chenhc@lemote.com>
> > > > > > > ---
> > > > > > >  MAINTAINERS | 4 +++-
> > > > > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > > > >
> > > > > > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > > > > > index bddc79a..5f9c2fd 100644
> > > > > > > --- a/MAINTAINERS
> > > > > > > +++ b/MAINTAINERS
> > > > > > > @@ -9441,9 +9441,11 @@ F: arch/arm64/kvm/
> > > > > > >  F:       include/kvm/arm_*
> > > > > > >
> > > > > > >  KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)
> > > > > > > +M:       Huacai Chen <chenhc@lemote.com>
> > > > > > > +M:       Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
> > > > > > >  L:       linux-mips@vger.kernel.org
> > > > > > >  L:       kvm@vger.kernel.org
> > > > > > > -S:       Orphan
> > > > > > > +S:       Maintained
> > > > > > >  F:       arch/mips/include/asm/kvm*
> > > > > > >  F:       arch/mips/include/uapi/asm/kvm*
> > > > > > >  F:       arch/mips/kvm/
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > Is kvm/mips still maintained? Thanks.
> > > > > >
> > > > > > I tried v6.4-rc6 and hit the following crash. It seems it has been broken since
> > > > > >
> > > > > >   commit 45c7e8af4a5e3f0bea4ac209eea34118dd57ac64
> > > > > >   Author: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > > > > >   Date:   Mon Mar 1 16:29:57 2021 +0100
> > > > > >
> > > > > >       MIPS: Remove KVM_TE support
> > > > >
> > > > > ok, I see what I missed when removing TE support, d'oh. Does the patch
> > > > > below fix the issue for you ?
> > > >
> > > > Thanks!
> > > >
> > > > It made some progress but somehow crashed the guest kernel.
> > > >
> > > > $ qemu-system-mips64el --version
> > > > QEMU emulator version 7.2.2 (Debian 1:7.2+dfsg-7)
> > > > Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
> > > >
> > > > # w/o KVM
> > > >
> > > >   # malta: working (but slow)
> > > >
> > > >     $ qemu-system-mips64el -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
> > > >     [    0.000000] Linux version 4.9.58 (buildbot@builds) (gcc version 5.5.0 (LEDE GCC 5.5.0 r5218-f90f94d) ) #0 SMP Wed Nov 1 21:08:14 2017
> > > >     ...
> > > >
> > > >   # loongson3-virt: hanged
> > > >
> > > >     $ qemu-system-mips64el -M loongson3-virt -m 512m -nographic -kernel vmlinuz-6.1.0-9-loongson-3 -initrd initrd.gz
> > > >     [    0.000000] Linux version 6.1.0-9-loongson-3 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT Debian 6.1.27-1 (2023-05-08)
> > > >     ...
> > > >     [    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000009fffffff]
> > > >
> > > > # w/ KVM
> > > >
> > > >   # malta: qemu error
> > > >
> > > >     $ sudo qemu-system-mips64el -M accel=kvm -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
> > > >     qemu-system-mips64el: KVM guest kernels must be linked in useg. Did you forget to enable CONFIG_KVM_GUEST?
> > > >
> > > >   # loongson3-virt: qemu error
> > > >
> > > >     $ sudo qemu-system-mips64el -M loongson3-virt,accel=kvm -m 512m -nographic -kernel vmlinuz-6.1.0-9-loongson-3 -initrd initrd.gz
> > > >     qemu-system-mips64el: ../../accel/kvm/kvm-all.c:2310: kvm_init: Assertion `TARGET_PAGE_SIZE <= qemu_real_host_page_size()' failed.
> > > >     Aborted
> > > >
> > > > $ qemu-system-mips64el --version
> > > > QEMU emulator version 8.0.2 (Debian 1:8.0.2+dfsg-1)
> > > > Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
> > > >
> > > > # w/o KVM
> > > >
> > > >   # malta: no change
> > > >   # loongson3-virt: no change
> > > >
> > > > # w/ KVM
> > > >
> > > >   # loongson3-virt: the same qemu error
> > > >
> > > >   # malta: booted very fast but guest crashed:
> > > >
> > > > $ sudo qemu-system-mips64el -M accel=kvm -nographic -kernel lede-malta-le64-vmlinux-initramfs.elf
> > > > [    0.000000] Linux version 4.9.58 (buildbot@builds) (gcc version 5.5.0 (LEDE GCC 5.5.0 r5218-f90f94d) ) #0 SMP Wed Nov 1 21:08:14 2017
> >
> > ...
> >
> > > > [    0.402570] Kernel panic - not syncing: Fatal exception
> > > > [    0.404311] Rebooting in 1 seconds..
> > > > [    2.385408] Reboot failed -- System halted
> > > >
> > > > openwrt/malta: https://downloads.openwrt.org/snapshots/targets/malta/le64/
> > > > debian/loongson-3: https://deb.debian.org/debian/dists/sid/main/installer-mips64el/current/images/
> > > > debian/malta: not working
> > >
> > > I have reproduced the problem, and I hope I can fix it in a few days,
> >
> > That's great. Thanks a lot!
> I fixed the KVM problems on Loongson [1][2][3]. However, you have
> tried [1] but still have problems, while [2] and [3] are specific to
> Loongson, so maybe you are still unable to use KVM.
>
> [1] https://lore.kernel.org/linux-mips/20230626074919.1871944-1-chenhuacai@loongson.cn/T/#u
> [2] https://lore.kernel.org/linux-mips/20230626075014.1872632-1-chenhuacai@loongson.cn/T/#u
> [3] https://lore.kernel.org/linux-mips/20230626075047.1872818-1-chenhuacai@loongson.cn/T/#u

Thanks for the update. I'll take a look if I get a chance.

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-06-27 18:58 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29  6:58 [PATCH 1/5] PCI: Move PCI_VENDOR_ID_REDHAT definition to pci_ids.h Huacai Chen
2020-07-29  6:58 ` [PATCH 2/5] dt-bindings: mips: Document Loongson kvm guest board Huacai Chen
2020-07-29  9:52   ` Thomas Bogendoerfer
2020-07-29 10:08     ` Huacai Chen
2020-07-31  3:01       ` Huacai Chen
2020-07-31  8:32         ` Thomas Bogendoerfer
2020-07-31 11:56           ` Jiaxun Yang
2020-08-03  6:05             ` Huacai Chen
2020-08-03  9:13               ` Jiaxun Yang
2020-08-04  7:47                 ` Thomas Bogendoerfer
2020-07-29  6:58 ` [PATCH 3/5] MIPS: KVM: Add kvm guest support for Loongson-3 Huacai Chen
2020-07-29  6:58 ` [PATCH 4/5] MIPS: Update default config file " Huacai Chen
2020-07-29  6:58 ` [PATCH 5/5] MAINTAINERS: Update KVM/MIPS maintainers Huacai Chen
2023-06-16  7:18   ` Yu Zhao
2023-06-16  7:55     ` Huacai Chen
2023-06-16  8:23     ` Thomas Bogendoerfer
2023-06-16  8:31       ` Huacai Chen
2023-06-18  7:55         ` Thomas Bogendoerfer
2023-06-17  1:52       ` Yu Zhao
2023-06-18  2:13         ` Huacai Chen
2023-06-18  2:51           ` Yu Zhao
2023-06-26  8:00             ` Huacai Chen
2023-06-27 18:58               ` Yu Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).