1 | The following changes since commit 4b7ea33074450bc6148c8e1545d78f179e64adb4: | 1 | The following changes since commit a5ba0a7e4e150d1350a041f0d0ef9ca6c8d7c307: |
---|---|---|---|
2 | 2 | ||
3 | Merge tag 'pull-request-2024-09-11' of https://gitlab.com/thuth/qemu into staging (2024-09-11 19:28:23 +0100) | 3 | Merge tag 'pull-aspeed-20241211' of https://github.com/legoater/qemu into staging (2024-12-11 15:16:47 +0000) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20240912 | 7 | https://gitlab.com/bibo-mao/qemu.git pull-loongarch-20241213 |
8 | 8 | ||
9 | for you to fetch changes up to 45d1fe46e5a6fe2b22b034e2b2bc0d941acd4b9e: | 9 | for you to fetch changes up to 78aa256571aa06f32001bd80635a1858187c609b: |
10 | 10 | ||
11 | hw/loongarch: Add acpi SPCR table support (2024-09-12 20:57:54 +0800) | 11 | hw/intc/loongarch_pch: Code cleanup about loongarch_pch_pic (2024-12-13 14:39:39 +0800) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | pull-loongarch-20240912 | 14 | pull-loongarch-20241213 |
15 | 15 | ||
16 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
17 | Bibo Mao (5): | 17 | Bibo Mao (8): |
18 | target/loongarch: Add compatible support about VM reboot | 18 | include: Add loongarch_pic_common header file |
19 | hw/loongarch: Remove default enable with VIRTIO_VGA device | 19 | include: Move struct LoongArchPCHPIC to loongarch_pic_common header file |
20 | target/loongarch/kvm: Add vCPU reset function | 20 | hw/intc/loongarch_pch: Merge instance_init() into realize() |
21 | target/loongarch: Support QMP dump-guest-memory | 21 | hw/intc/loongarch_pch: Rename LoongArchPCHPIC with LoongArchPICCommonState |
22 | hw/loongarch: Add acpi SPCR table support | 22 | hw/intc/loongarch_pch: Move some functions to file loongarch_pic_common |
23 | hw/intc/loongarch_pch: Inherit from loongarch_pic_common | ||
24 | hw/intc/loongarch_pch: Add pre_save and post_load interfaces | ||
25 | hw/intc/loongarch_pch: Code cleanup about loongarch_pch_pic | ||
23 | 26 | ||
24 | Jason A. Donenfeld (2): | 27 | hw/intc/loongarch_pch_pic.c | 106 +++++++++++---------------------- |
25 | hw/loongarch: virt: support up to 4 serial ports | 28 | hw/intc/loongarch_pic_common.c | 97 ++++++++++++++++++++++++++++++ |
26 | hw/loongarch: virt: pass random seed to fdt | 29 | hw/intc/meson.build | 2 +- |
27 | 30 | hw/loongarch/virt.c | 2 +- | |
28 | hw/loongarch/Kconfig | 1 - | 31 | include/hw/intc/loongarch_pch_pic.h | 70 +++++----------------- |
29 | hw/loongarch/acpi-build.c | 63 +++++++++++-- | 32 | include/hw/intc/loongarch_pic_common.h | 82 +++++++++++++++++++++++++ |
30 | hw/loongarch/virt.c | 33 ++++--- | 33 | 6 files changed, 230 insertions(+), 129 deletions(-) |
31 | include/hw/pci-host/ls7a.h | 9 +- | 34 | create mode 100644 hw/intc/loongarch_pic_common.c |
32 | target/loongarch/arch_dump.c | 167 +++++++++++++++++++++++++++++++++++ | 35 | create mode 100644 include/hw/intc/loongarch_pic_common.h |
33 | target/loongarch/cpu.c | 17 +++- | ||
34 | target/loongarch/internals.h | 2 + | ||
35 | target/loongarch/kvm/kvm.c | 5 +- | ||
36 | target/loongarch/kvm/kvm_loongarch.h | 2 +- | ||
37 | target/loongarch/meson.build | 1 + | ||
38 | 10 files changed, 274 insertions(+), 26 deletions(-) | ||
39 | create mode 100644 target/loongarch/arch_dump.c | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Add common header file hw/intc/loongarch_pic_common.h, and move | ||
2 | some macro definition from hw/intc/loongarch_pch_pic.h to the common | ||
3 | header file. | ||
1 | 4 | ||
5 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | ||
6 | Reviewed-by: Song Gao <gaosong@loongson.cn> | ||
7 | --- | ||
8 | include/hw/intc/loongarch_pch_pic.h | 36 +++------------------- | ||
9 | include/hw/intc/loongarch_pic_common.h | 42 ++++++++++++++++++++++++++ | ||
10 | 2 files changed, 47 insertions(+), 31 deletions(-) | ||
11 | create mode 100644 include/hw/intc/loongarch_pic_common.h | ||
12 | |||
13 | diff --git a/include/hw/intc/loongarch_pch_pic.h b/include/hw/intc/loongarch_pch_pic.h | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/include/hw/intc/loongarch_pch_pic.h | ||
16 | +++ b/include/hw/intc/loongarch_pch_pic.h | ||
17 | @@ -XXX,XX +XXX,XX @@ | ||
18 | * Copyright (c) 2021 Loongson Technology Corporation Limited | ||
19 | */ | ||
20 | |||
21 | -#include "hw/sysbus.h" | ||
22 | +#ifndef HW_LOONGARCH_PCH_PIC_H | ||
23 | +#define HW_LOONGARCH_PCH_PIC_H | ||
24 | + | ||
25 | +#include "hw/intc/loongarch_pic_common.h" | ||
26 | |||
27 | #define TYPE_LOONGARCH_PCH_PIC "loongarch_pch_pic" | ||
28 | #define PCH_PIC_NAME(name) TYPE_LOONGARCH_PCH_PIC#name | ||
29 | OBJECT_DECLARE_SIMPLE_TYPE(LoongArchPCHPIC, LOONGARCH_PCH_PIC) | ||
30 | |||
31 | -#define PCH_PIC_INT_ID_VAL 0x7000000UL | ||
32 | -#define PCH_PIC_INT_ID_VER 0x1UL | ||
33 | - | ||
34 | -#define PCH_PIC_INT_ID_LO 0x00 | ||
35 | -#define PCH_PIC_INT_ID_HI 0x04 | ||
36 | -#define PCH_PIC_INT_MASK_LO 0x20 | ||
37 | -#define PCH_PIC_INT_MASK_HI 0x24 | ||
38 | -#define PCH_PIC_HTMSI_EN_LO 0x40 | ||
39 | -#define PCH_PIC_HTMSI_EN_HI 0x44 | ||
40 | -#define PCH_PIC_INT_EDGE_LO 0x60 | ||
41 | -#define PCH_PIC_INT_EDGE_HI 0x64 | ||
42 | -#define PCH_PIC_INT_CLEAR_LO 0x80 | ||
43 | -#define PCH_PIC_INT_CLEAR_HI 0x84 | ||
44 | -#define PCH_PIC_AUTO_CTRL0_LO 0xc0 | ||
45 | -#define PCH_PIC_AUTO_CTRL0_HI 0xc4 | ||
46 | -#define PCH_PIC_AUTO_CTRL1_LO 0xe0 | ||
47 | -#define PCH_PIC_AUTO_CTRL1_HI 0xe4 | ||
48 | -#define PCH_PIC_ROUTE_ENTRY_OFFSET 0x100 | ||
49 | -#define PCH_PIC_ROUTE_ENTRY_END 0x13f | ||
50 | -#define PCH_PIC_HTMSI_VEC_OFFSET 0x200 | ||
51 | -#define PCH_PIC_HTMSI_VEC_END 0x23f | ||
52 | -#define PCH_PIC_INT_STATUS_LO 0x3a0 | ||
53 | -#define PCH_PIC_INT_STATUS_HI 0x3a4 | ||
54 | -#define PCH_PIC_INT_POL_LO 0x3e0 | ||
55 | -#define PCH_PIC_INT_POL_HI 0x3e4 | ||
56 | - | ||
57 | -#define STATUS_LO_START 0 | ||
58 | -#define STATUS_HI_START 0x4 | ||
59 | -#define POL_LO_START 0x40 | ||
60 | -#define POL_HI_START 0x44 | ||
61 | struct LoongArchPCHPIC { | ||
62 | SysBusDevice parent_obj; | ||
63 | qemu_irq parent_irq[64]; | ||
64 | @@ -XXX,XX +XXX,XX @@ struct LoongArchPCHPIC { | ||
65 | MemoryRegion iomem8; | ||
66 | unsigned int irq_num; | ||
67 | }; | ||
68 | +#endif /* HW_LOONGARCH_PCH_PIC_H */ | ||
69 | diff --git a/include/hw/intc/loongarch_pic_common.h b/include/hw/intc/loongarch_pic_common.h | ||
70 | new file mode 100644 | ||
71 | index XXXXXXX..XXXXXXX | ||
72 | --- /dev/null | ||
73 | +++ b/include/hw/intc/loongarch_pic_common.h | ||
74 | @@ -XXX,XX +XXX,XX @@ | ||
75 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
76 | +/* | ||
77 | + * LoongArch 7A1000 I/O interrupt controller definitions | ||
78 | + * Copyright (c) 2024 Loongson Technology Corporation Limited | ||
79 | + */ | ||
80 | + | ||
81 | +#ifndef HW_LOONGARCH_PIC_COMMON_H | ||
82 | +#define HW_LOONGARCH_PIC_COMMON_H | ||
83 | + | ||
84 | +#include "hw/pci-host/ls7a.h" | ||
85 | +#include "hw/sysbus.h" | ||
86 | + | ||
87 | +#define PCH_PIC_INT_ID_VAL 0x7000000UL | ||
88 | +#define PCH_PIC_INT_ID_VER 0x1UL | ||
89 | +#define PCH_PIC_INT_ID_LO 0x00 | ||
90 | +#define PCH_PIC_INT_ID_HI 0x04 | ||
91 | +#define PCH_PIC_INT_MASK_LO 0x20 | ||
92 | +#define PCH_PIC_INT_MASK_HI 0x24 | ||
93 | +#define PCH_PIC_HTMSI_EN_LO 0x40 | ||
94 | +#define PCH_PIC_HTMSI_EN_HI 0x44 | ||
95 | +#define PCH_PIC_INT_EDGE_LO 0x60 | ||
96 | +#define PCH_PIC_INT_EDGE_HI 0x64 | ||
97 | +#define PCH_PIC_INT_CLEAR_LO 0x80 | ||
98 | +#define PCH_PIC_INT_CLEAR_HI 0x84 | ||
99 | +#define PCH_PIC_AUTO_CTRL0_LO 0xc0 | ||
100 | +#define PCH_PIC_AUTO_CTRL0_HI 0xc4 | ||
101 | +#define PCH_PIC_AUTO_CTRL1_LO 0xe0 | ||
102 | +#define PCH_PIC_AUTO_CTRL1_HI 0xe4 | ||
103 | +#define PCH_PIC_ROUTE_ENTRY_OFFSET 0x100 | ||
104 | +#define PCH_PIC_ROUTE_ENTRY_END 0x13f | ||
105 | +#define PCH_PIC_HTMSI_VEC_OFFSET 0x200 | ||
106 | +#define PCH_PIC_HTMSI_VEC_END 0x23f | ||
107 | +#define PCH_PIC_INT_STATUS_LO 0x3a0 | ||
108 | +#define PCH_PIC_INT_STATUS_HI 0x3a4 | ||
109 | +#define PCH_PIC_INT_POL_LO 0x3e0 | ||
110 | +#define PCH_PIC_INT_POL_HI 0x3e4 | ||
111 | + | ||
112 | +#define STATUS_LO_START 0 | ||
113 | +#define STATUS_HI_START 0x4 | ||
114 | +#define POL_LO_START 0x40 | ||
115 | +#define POL_HI_START 0x44 | ||
116 | +#endif /* HW_LOONGARCH_PIC_COMMON_H */ | ||
117 | -- | ||
118 | 2.43.5 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Move structure LoongArchPCHPIC from header file loongarch_pch_pic.h | ||
2 | to file loongarch_pic_common.h, and rename structure name with | ||
3 | LoongArchPICCommonState. | ||
1 | 4 | ||
5 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | ||
6 | Reviewed-by: Song Gao <gaosong@loongson.cn> | ||
7 | --- | ||
8 | include/hw/intc/loongarch_pch_pic.h | 27 +------------------------ | ||
9 | include/hw/intc/loongarch_pic_common.h | 28 ++++++++++++++++++++++++++ | ||
10 | 2 files changed, 29 insertions(+), 26 deletions(-) | ||
11 | |||
12 | diff --git a/include/hw/intc/loongarch_pch_pic.h b/include/hw/intc/loongarch_pch_pic.h | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/include/hw/intc/loongarch_pch_pic.h | ||
15 | +++ b/include/hw/intc/loongarch_pch_pic.h | ||
16 | @@ -XXX,XX +XXX,XX @@ | ||
17 | |||
18 | #include "hw/intc/loongarch_pic_common.h" | ||
19 | |||
20 | +#define LoongArchPCHPIC LoongArchPICCommonState | ||
21 | #define TYPE_LOONGARCH_PCH_PIC "loongarch_pch_pic" | ||
22 | #define PCH_PIC_NAME(name) TYPE_LOONGARCH_PCH_PIC#name | ||
23 | OBJECT_DECLARE_SIMPLE_TYPE(LoongArchPCHPIC, LOONGARCH_PCH_PIC) | ||
24 | |||
25 | -struct LoongArchPCHPIC { | ||
26 | - SysBusDevice parent_obj; | ||
27 | - qemu_irq parent_irq[64]; | ||
28 | - uint64_t int_mask; /*0x020 interrupt mask register*/ | ||
29 | - uint64_t htmsi_en; /*0x040 1=msi*/ | ||
30 | - uint64_t intedge; /*0x060 edge=1 level =0*/ | ||
31 | - uint64_t intclr; /*0x080 for clean edge int,set 1 clean,set 0 is noused*/ | ||
32 | - uint64_t auto_crtl0; /*0x0c0*/ | ||
33 | - uint64_t auto_crtl1; /*0x0e0*/ | ||
34 | - uint64_t last_intirr; /* edge detection */ | ||
35 | - uint64_t intirr; /* 0x380 interrupt request register */ | ||
36 | - uint64_t intisr; /* 0x3a0 interrupt service register */ | ||
37 | - /* | ||
38 | - * 0x3e0 interrupt level polarity selection | ||
39 | - * register 0 for high level trigger | ||
40 | - */ | ||
41 | - uint64_t int_polarity; | ||
42 | - | ||
43 | - uint8_t route_entry[64]; /*0x100 - 0x138*/ | ||
44 | - uint8_t htmsi_vector[64]; /*0x200 - 0x238*/ | ||
45 | - | ||
46 | - MemoryRegion iomem32_low; | ||
47 | - MemoryRegion iomem32_high; | ||
48 | - MemoryRegion iomem8; | ||
49 | - unsigned int irq_num; | ||
50 | -}; | ||
51 | #endif /* HW_LOONGARCH_PCH_PIC_H */ | ||
52 | diff --git a/include/hw/intc/loongarch_pic_common.h b/include/hw/intc/loongarch_pic_common.h | ||
53 | index XXXXXXX..XXXXXXX 100644 | ||
54 | --- a/include/hw/intc/loongarch_pic_common.h | ||
55 | +++ b/include/hw/intc/loongarch_pic_common.h | ||
56 | @@ -XXX,XX +XXX,XX @@ | ||
57 | #define STATUS_HI_START 0x4 | ||
58 | #define POL_LO_START 0x40 | ||
59 | #define POL_HI_START 0x44 | ||
60 | + | ||
61 | +struct LoongArchPICCommonState { | ||
62 | + SysBusDevice parent_obj; | ||
63 | + | ||
64 | + qemu_irq parent_irq[64]; | ||
65 | + uint64_t int_mask; /* 0x020 interrupt mask register */ | ||
66 | + uint64_t htmsi_en; /* 0x040 1=msi */ | ||
67 | + uint64_t intedge; /* 0x060 edge=1 level=0 */ | ||
68 | + uint64_t intclr; /* 0x080 clean edge int, set 1 clean, 0 noused */ | ||
69 | + uint64_t auto_crtl0; /* 0x0c0 */ | ||
70 | + uint64_t auto_crtl1; /* 0x0e0 */ | ||
71 | + uint64_t last_intirr; /* edge detection */ | ||
72 | + uint64_t intirr; /* 0x380 interrupt request register */ | ||
73 | + uint64_t intisr; /* 0x3a0 interrupt service register */ | ||
74 | + /* | ||
75 | + * 0x3e0 interrupt level polarity selection | ||
76 | + * register 0 for high level trigger | ||
77 | + */ | ||
78 | + uint64_t int_polarity; | ||
79 | + | ||
80 | + uint8_t route_entry[64]; /* 0x100 - 0x138 */ | ||
81 | + uint8_t htmsi_vector[64]; /* 0x200 - 0x238 */ | ||
82 | + | ||
83 | + MemoryRegion iomem32_low; | ||
84 | + MemoryRegion iomem32_high; | ||
85 | + MemoryRegion iomem8; | ||
86 | + unsigned int irq_num; | ||
87 | +}; | ||
88 | #endif /* HW_LOONGARCH_PIC_COMMON_H */ | ||
89 | -- | ||
90 | 2.43.5 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Memory region is created in instance_init(), merge it into function | ||
2 | realize(). There is no special class_init() for loongarch_pch object. | ||
1 | 3 | ||
4 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | ||
5 | Reviewed-by: Song Gao <gaosong@loongson.cn> | ||
6 | --- | ||
7 | hw/intc/loongarch_pch_pic.c | 15 ++++----------- | ||
8 | 1 file changed, 4 insertions(+), 11 deletions(-) | ||
9 | |||
10 | diff --git a/hw/intc/loongarch_pch_pic.c b/hw/intc/loongarch_pch_pic.c | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/hw/intc/loongarch_pch_pic.c | ||
13 | +++ b/hw/intc/loongarch_pch_pic.c | ||
14 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_reset(DeviceState *d) | ||
15 | static void loongarch_pch_pic_realize(DeviceState *dev, Error **errp) | ||
16 | { | ||
17 | LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(dev); | ||
18 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
19 | |||
20 | if (!s->irq_num || s->irq_num > VIRT_PCH_PIC_IRQ_NUM) { | ||
21 | error_setg(errp, "Invalid 'pic_irq_num'"); | ||
22 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_realize(DeviceState *dev, Error **errp) | ||
23 | |||
24 | qdev_init_gpio_out(dev, s->parent_irq, s->irq_num); | ||
25 | qdev_init_gpio_in(dev, pch_pic_irq_handler, s->irq_num); | ||
26 | -} | ||
27 | - | ||
28 | -static void loongarch_pch_pic_init(Object *obj) | ||
29 | -{ | ||
30 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(obj); | ||
31 | - SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | ||
32 | - | ||
33 | - memory_region_init_io(&s->iomem32_low, obj, | ||
34 | + memory_region_init_io(&s->iomem32_low, OBJECT(dev), | ||
35 | &loongarch_pch_pic_reg32_low_ops, | ||
36 | s, PCH_PIC_NAME(.reg32_part1), 0x100); | ||
37 | - memory_region_init_io(&s->iomem8, obj, &loongarch_pch_pic_reg8_ops, | ||
38 | + memory_region_init_io(&s->iomem8, OBJECT(dev), &loongarch_pch_pic_reg8_ops, | ||
39 | s, PCH_PIC_NAME(.reg8), 0x2a0); | ||
40 | - memory_region_init_io(&s->iomem32_high, obj, | ||
41 | + memory_region_init_io(&s->iomem32_high, OBJECT(dev), | ||
42 | &loongarch_pch_pic_reg32_high_ops, | ||
43 | s, PCH_PIC_NAME(.reg32_part2), 0xc60); | ||
44 | sysbus_init_mmio(sbd, &s->iomem32_low); | ||
45 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo loongarch_pch_pic_info = { | ||
46 | .name = TYPE_LOONGARCH_PCH_PIC, | ||
47 | .parent = TYPE_SYS_BUS_DEVICE, | ||
48 | .instance_size = sizeof(LoongArchPCHPIC), | ||
49 | - .instance_init = loongarch_pch_pic_init, | ||
50 | .class_init = loongarch_pch_pic_class_init, | ||
51 | }; | ||
52 | |||
53 | -- | ||
54 | 2.43.5 | diff view generated by jsdifflib |
1 | From: Bibo Mao <maobibo@loongson.cn> | 1 | With pic vmstate, rename structure name vmstate_loongarch_pch_pic with |
---|---|---|---|
2 | 2 | vmstate_loongarch_pic_common, and with pic property rename | |
3 | KVM provides interface KVM_REG_LOONGARCH_VCPU_RESET to reset vCPU, | 3 | loongarch_pch_pic_properties with loongarch_pic_common_properties. |
4 | it can be used to clear internal state about kvm kernel. vCPU reset | ||
5 | function is added here for kvm mode. | ||
6 | 4 | ||
7 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | 5 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> |
8 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 6 | Reviewed-by: Song Gao <gaosong@loongson.cn> |
9 | Message-Id: <20240822022827.2273534-1-maobibo@loongson.cn> | ||
10 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
11 | --- | 7 | --- |
12 | target/loongarch/cpu.c | 2 +- | 8 | hw/intc/loongarch_pch_pic.c | 52 +++++++++++++++++++++++-------------- |
13 | target/loongarch/kvm/kvm.c | 5 ++++- | 9 | 1 file changed, 32 insertions(+), 20 deletions(-) |
14 | target/loongarch/kvm/kvm_loongarch.h | 2 +- | ||
15 | 3 files changed, 6 insertions(+), 3 deletions(-) | ||
16 | 10 | ||
17 | diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c | 11 | diff --git a/hw/intc/loongarch_pch_pic.c b/hw/intc/loongarch_pch_pic.c |
18 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/loongarch/cpu.c | 13 | --- a/hw/intc/loongarch_pch_pic.c |
20 | +++ b/target/loongarch/cpu.c | 14 | +++ b/hw/intc/loongarch_pch_pic.c |
21 | @@ -XXX,XX +XXX,XX @@ static void loongarch_cpu_reset_hold(Object *obj, ResetType type) | 15 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_reset(DeviceState *d) |
22 | memset(env->tlb, 0, sizeof(env->tlb)); | 16 | s->int_polarity = 0x0; |
23 | #endif | 17 | } |
24 | if (kvm_enabled()) { | 18 | |
25 | - kvm_arch_reset_vcpu(env); | 19 | +static void loongarch_pic_common_realize(DeviceState *dev, Error **errp) |
26 | + kvm_arch_reset_vcpu(cs); | 20 | +{ |
21 | + LoongArchPICCommonState *s = LOONGARCH_PCH_PIC(dev); | ||
22 | + | ||
23 | + if (!s->irq_num || s->irq_num > VIRT_PCH_PIC_IRQ_NUM) { | ||
24 | + error_setg(errp, "Invalid 'pic_irq_num'"); | ||
25 | + return; | ||
26 | + } | ||
27 | +} | ||
28 | + | ||
29 | static void loongarch_pch_pic_realize(DeviceState *dev, Error **errp) | ||
30 | { | ||
31 | LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(dev); | ||
32 | SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
33 | + Error *local_err = NULL; | ||
34 | |||
35 | - if (!s->irq_num || s->irq_num > VIRT_PCH_PIC_IRQ_NUM) { | ||
36 | - error_setg(errp, "Invalid 'pic_irq_num'"); | ||
37 | + loongarch_pic_common_realize(dev, &local_err); | ||
38 | + if (local_err) { | ||
39 | + error_propagate(errp, local_err); | ||
40 | return; | ||
27 | } | 41 | } |
28 | #endif | 42 | |
29 | 43 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_realize(DeviceState *dev, Error **errp) | |
30 | diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c | 44 | |
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/target/loongarch/kvm/kvm.c | ||
33 | +++ b/target/loongarch/kvm/kvm.c | ||
34 | @@ -XXX,XX +XXX,XX @@ static int kvm_loongarch_put_regs_fp(CPUState *cs) | ||
35 | return ret; | ||
36 | } | 45 | } |
37 | 46 | ||
38 | -void kvm_arch_reset_vcpu(CPULoongArchState *env) | 47 | -static Property loongarch_pch_pic_properties[] = { |
39 | +void kvm_arch_reset_vcpu(CPUState *cs) | 48 | - DEFINE_PROP_UINT32("pch_pic_irq_num", LoongArchPCHPIC, irq_num, 0), |
40 | { | 49 | +static Property loongarch_pic_common_properties[] = { |
41 | + CPULoongArchState *env = cpu_env(cs); | 50 | + DEFINE_PROP_UINT32("pch_pic_irq_num", LoongArchPICCommonState, irq_num, 0), |
42 | + | 51 | DEFINE_PROP_END_OF_LIST(), |
43 | env->mp_state = KVM_MP_STATE_RUNNABLE; | 52 | }; |
44 | + kvm_set_one_reg(cs, KVM_REG_LOONGARCH_VCPU_RESET, 0); | 53 | |
54 | -static const VMStateDescription vmstate_loongarch_pch_pic = { | ||
55 | - .name = TYPE_LOONGARCH_PCH_PIC, | ||
56 | +static const VMStateDescription vmstate_loongarch_pic_common = { | ||
57 | + .name = "loongarch_pch_pic", | ||
58 | .version_id = 1, | ||
59 | .minimum_version_id = 1, | ||
60 | .fields = (const VMStateField[]) { | ||
61 | - VMSTATE_UINT64(int_mask, LoongArchPCHPIC), | ||
62 | - VMSTATE_UINT64(htmsi_en, LoongArchPCHPIC), | ||
63 | - VMSTATE_UINT64(intedge, LoongArchPCHPIC), | ||
64 | - VMSTATE_UINT64(intclr, LoongArchPCHPIC), | ||
65 | - VMSTATE_UINT64(auto_crtl0, LoongArchPCHPIC), | ||
66 | - VMSTATE_UINT64(auto_crtl1, LoongArchPCHPIC), | ||
67 | - VMSTATE_UINT8_ARRAY(route_entry, LoongArchPCHPIC, 64), | ||
68 | - VMSTATE_UINT8_ARRAY(htmsi_vector, LoongArchPCHPIC, 64), | ||
69 | - VMSTATE_UINT64(last_intirr, LoongArchPCHPIC), | ||
70 | - VMSTATE_UINT64(intirr, LoongArchPCHPIC), | ||
71 | - VMSTATE_UINT64(intisr, LoongArchPCHPIC), | ||
72 | - VMSTATE_UINT64(int_polarity, LoongArchPCHPIC), | ||
73 | + VMSTATE_UINT64(int_mask, LoongArchPICCommonState), | ||
74 | + VMSTATE_UINT64(htmsi_en, LoongArchPICCommonState), | ||
75 | + VMSTATE_UINT64(intedge, LoongArchPICCommonState), | ||
76 | + VMSTATE_UINT64(intclr, LoongArchPICCommonState), | ||
77 | + VMSTATE_UINT64(auto_crtl0, LoongArchPICCommonState), | ||
78 | + VMSTATE_UINT64(auto_crtl1, LoongArchPICCommonState), | ||
79 | + VMSTATE_UINT8_ARRAY(route_entry, LoongArchPICCommonState, 64), | ||
80 | + VMSTATE_UINT8_ARRAY(htmsi_vector, LoongArchPICCommonState, 64), | ||
81 | + VMSTATE_UINT64(last_intirr, LoongArchPICCommonState), | ||
82 | + VMSTATE_UINT64(intirr, LoongArchPICCommonState), | ||
83 | + VMSTATE_UINT64(intisr, LoongArchPICCommonState), | ||
84 | + VMSTATE_UINT64(int_polarity, LoongArchPICCommonState), | ||
85 | VMSTATE_END_OF_LIST() | ||
86 | } | ||
87 | }; | ||
88 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_class_init(ObjectClass *klass, void *data) | ||
89 | |||
90 | dc->realize = loongarch_pch_pic_realize; | ||
91 | device_class_set_legacy_reset(dc, loongarch_pch_pic_reset); | ||
92 | - dc->vmsd = &vmstate_loongarch_pch_pic; | ||
93 | - device_class_set_props(dc, loongarch_pch_pic_properties); | ||
94 | + dc->vmsd = &vmstate_loongarch_pic_common; | ||
95 | + device_class_set_props(dc, loongarch_pic_common_properties); | ||
45 | } | 96 | } |
46 | 97 | ||
47 | static int kvm_loongarch_get_mpstate(CPUState *cs) | 98 | static const TypeInfo loongarch_pch_pic_info = { |
48 | diff --git a/target/loongarch/kvm/kvm_loongarch.h b/target/loongarch/kvm/kvm_loongarch.h | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/target/loongarch/kvm/kvm_loongarch.h | ||
51 | +++ b/target/loongarch/kvm/kvm_loongarch.h | ||
52 | @@ -XXX,XX +XXX,XX @@ | ||
53 | #define QEMU_KVM_LOONGARCH_H | ||
54 | |||
55 | int kvm_loongarch_set_interrupt(LoongArchCPU *cpu, int irq, int level); | ||
56 | -void kvm_arch_reset_vcpu(CPULoongArchState *env); | ||
57 | +void kvm_arch_reset_vcpu(CPUState *cs); | ||
58 | |||
59 | #endif | ||
60 | -- | 99 | -- |
61 | 2.34.1 | 100 | 2.43.5 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Move some common functions to file loongarch_pic_common.c, the common | ||
2 | functions include loongarch_pic_common_realize(), property structure | ||
3 | loongarch_pic_common_properties and vmstate structure | ||
4 | vmstate_loongarch_pic_common. | ||
1 | 5 | ||
6 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | ||
7 | Reviewed-by: Song Gao <gaosong@loongson.cn> | ||
8 | --- | ||
9 | hw/intc/loongarch_pch_pic.c | 37 +----------------------------- | ||
10 | hw/intc/loongarch_pic_common.c | 41 ++++++++++++++++++++++++++++++++++ | ||
11 | 2 files changed, 42 insertions(+), 36 deletions(-) | ||
12 | create mode 100644 hw/intc/loongarch_pic_common.c | ||
13 | |||
14 | diff --git a/hw/intc/loongarch_pch_pic.c b/hw/intc/loongarch_pch_pic.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/intc/loongarch_pch_pic.c | ||
17 | +++ b/hw/intc/loongarch_pch_pic.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_reset(DeviceState *d) | ||
19 | s->int_polarity = 0x0; | ||
20 | } | ||
21 | |||
22 | -static void loongarch_pic_common_realize(DeviceState *dev, Error **errp) | ||
23 | -{ | ||
24 | - LoongArchPICCommonState *s = LOONGARCH_PCH_PIC(dev); | ||
25 | - | ||
26 | - if (!s->irq_num || s->irq_num > VIRT_PCH_PIC_IRQ_NUM) { | ||
27 | - error_setg(errp, "Invalid 'pic_irq_num'"); | ||
28 | - return; | ||
29 | - } | ||
30 | -} | ||
31 | - | ||
32 | +#include "loongarch_pic_common.c" | ||
33 | static void loongarch_pch_pic_realize(DeviceState *dev, Error **errp) | ||
34 | { | ||
35 | LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(dev); | ||
36 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_realize(DeviceState *dev, Error **errp) | ||
37 | |||
38 | } | ||
39 | |||
40 | -static Property loongarch_pic_common_properties[] = { | ||
41 | - DEFINE_PROP_UINT32("pch_pic_irq_num", LoongArchPICCommonState, irq_num, 0), | ||
42 | - DEFINE_PROP_END_OF_LIST(), | ||
43 | -}; | ||
44 | - | ||
45 | -static const VMStateDescription vmstate_loongarch_pic_common = { | ||
46 | - .name = "loongarch_pch_pic", | ||
47 | - .version_id = 1, | ||
48 | - .minimum_version_id = 1, | ||
49 | - .fields = (const VMStateField[]) { | ||
50 | - VMSTATE_UINT64(int_mask, LoongArchPICCommonState), | ||
51 | - VMSTATE_UINT64(htmsi_en, LoongArchPICCommonState), | ||
52 | - VMSTATE_UINT64(intedge, LoongArchPICCommonState), | ||
53 | - VMSTATE_UINT64(intclr, LoongArchPICCommonState), | ||
54 | - VMSTATE_UINT64(auto_crtl0, LoongArchPICCommonState), | ||
55 | - VMSTATE_UINT64(auto_crtl1, LoongArchPICCommonState), | ||
56 | - VMSTATE_UINT8_ARRAY(route_entry, LoongArchPICCommonState, 64), | ||
57 | - VMSTATE_UINT8_ARRAY(htmsi_vector, LoongArchPICCommonState, 64), | ||
58 | - VMSTATE_UINT64(last_intirr, LoongArchPICCommonState), | ||
59 | - VMSTATE_UINT64(intirr, LoongArchPICCommonState), | ||
60 | - VMSTATE_UINT64(intisr, LoongArchPICCommonState), | ||
61 | - VMSTATE_UINT64(int_polarity, LoongArchPICCommonState), | ||
62 | - VMSTATE_END_OF_LIST() | ||
63 | - } | ||
64 | -}; | ||
65 | - | ||
66 | static void loongarch_pch_pic_class_init(ObjectClass *klass, void *data) | ||
67 | { | ||
68 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
69 | diff --git a/hw/intc/loongarch_pic_common.c b/hw/intc/loongarch_pic_common.c | ||
70 | new file mode 100644 | ||
71 | index XXXXXXX..XXXXXXX | ||
72 | --- /dev/null | ||
73 | +++ b/hw/intc/loongarch_pic_common.c | ||
74 | @@ -XXX,XX +XXX,XX @@ | ||
75 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
76 | +/* | ||
77 | + * QEMU Loongson 7A1000 I/O interrupt controller. | ||
78 | + * Copyright (C) 2024 Loongson Technology Corporation Limited | ||
79 | + */ | ||
80 | + | ||
81 | +static void loongarch_pic_common_realize(DeviceState *dev, Error **errp) | ||
82 | +{ | ||
83 | + LoongArchPICCommonState *s = LOONGARCH_PCH_PIC(dev); | ||
84 | + | ||
85 | + if (!s->irq_num || s->irq_num > VIRT_PCH_PIC_IRQ_NUM) { | ||
86 | + error_setg(errp, "Invalid 'pic_irq_num'"); | ||
87 | + return; | ||
88 | + } | ||
89 | +} | ||
90 | + | ||
91 | +static Property loongarch_pic_common_properties[] = { | ||
92 | + DEFINE_PROP_UINT32("pch_pic_irq_num", LoongArchPICCommonState, irq_num, 0), | ||
93 | + DEFINE_PROP_END_OF_LIST(), | ||
94 | +}; | ||
95 | + | ||
96 | +static const VMStateDescription vmstate_loongarch_pic_common = { | ||
97 | + .name = "loongarch_pch_pic", | ||
98 | + .version_id = 1, | ||
99 | + .minimum_version_id = 1, | ||
100 | + .fields = (const VMStateField[]) { | ||
101 | + VMSTATE_UINT64(int_mask, LoongArchPICCommonState), | ||
102 | + VMSTATE_UINT64(htmsi_en, LoongArchPICCommonState), | ||
103 | + VMSTATE_UINT64(intedge, LoongArchPICCommonState), | ||
104 | + VMSTATE_UINT64(intclr, LoongArchPICCommonState), | ||
105 | + VMSTATE_UINT64(auto_crtl0, LoongArchPICCommonState), | ||
106 | + VMSTATE_UINT64(auto_crtl1, LoongArchPICCommonState), | ||
107 | + VMSTATE_UINT8_ARRAY(route_entry, LoongArchPICCommonState, 64), | ||
108 | + VMSTATE_UINT8_ARRAY(htmsi_vector, LoongArchPICCommonState, 64), | ||
109 | + VMSTATE_UINT64(last_intirr, LoongArchPICCommonState), | ||
110 | + VMSTATE_UINT64(intirr, LoongArchPICCommonState), | ||
111 | + VMSTATE_UINT64(intisr, LoongArchPICCommonState), | ||
112 | + VMSTATE_UINT64(int_polarity, LoongArchPICCommonState), | ||
113 | + VMSTATE_END_OF_LIST() | ||
114 | + } | ||
115 | +}; | ||
116 | -- | ||
117 | 2.43.5 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Set TYPE_LOONGARCH_PIC inherit from TYPE_LOONGARCH_PIC_COMMON object, | ||
2 | it shares vmsate and property of TYPE_LOONGARCH_PIC_COMMON, and has | ||
3 | its own realize() function. | ||
1 | 4 | ||
5 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | ||
6 | Reviewed-by: Song Gao <gaosong@loongson.cn> | ||
7 | --- | ||
8 | hw/intc/loongarch_pch_pic.c | 38 ++++++++++++-------------- | ||
9 | hw/intc/loongarch_pic_common.c | 32 +++++++++++++++++++++- | ||
10 | hw/intc/meson.build | 2 +- | ||
11 | include/hw/intc/loongarch_pch_pic.h | 21 +++++++++++--- | ||
12 | include/hw/intc/loongarch_pic_common.h | 10 +++++++ | ||
13 | 5 files changed, 77 insertions(+), 26 deletions(-) | ||
14 | |||
15 | diff --git a/hw/intc/loongarch_pch_pic.c b/hw/intc/loongarch_pch_pic.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/intc/loongarch_pch_pic.c | ||
18 | +++ b/hw/intc/loongarch_pch_pic.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_reset(DeviceState *d) | ||
20 | s->int_polarity = 0x0; | ||
21 | } | ||
22 | |||
23 | -#include "loongarch_pic_common.c" | ||
24 | -static void loongarch_pch_pic_realize(DeviceState *dev, Error **errp) | ||
25 | +static void loongarch_pic_realize(DeviceState *dev, Error **errp) | ||
26 | { | ||
27 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(dev); | ||
28 | - SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
29 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(dev); | ||
30 | + LoongarchPICClass *lpc = LOONGARCH_PIC_GET_CLASS(dev); | ||
31 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
32 | Error *local_err = NULL; | ||
33 | |||
34 | - loongarch_pic_common_realize(dev, &local_err); | ||
35 | + lpc->parent_realize(dev, &local_err); | ||
36 | if (local_err) { | ||
37 | error_propagate(errp, local_err); | ||
38 | return; | ||
39 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_realize(DeviceState *dev, Error **errp) | ||
40 | |||
41 | } | ||
42 | |||
43 | -static void loongarch_pch_pic_class_init(ObjectClass *klass, void *data) | ||
44 | +static void loongarch_pic_class_init(ObjectClass *klass, void *data) | ||
45 | { | ||
46 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
47 | + LoongarchPICClass *lpc = LOONGARCH_PIC_CLASS(klass); | ||
48 | |||
49 | - dc->realize = loongarch_pch_pic_realize; | ||
50 | device_class_set_legacy_reset(dc, loongarch_pch_pic_reset); | ||
51 | - dc->vmsd = &vmstate_loongarch_pic_common; | ||
52 | - device_class_set_props(dc, loongarch_pic_common_properties); | ||
53 | + device_class_set_parent_realize(dc, loongarch_pic_realize, | ||
54 | + &lpc->parent_realize); | ||
55 | } | ||
56 | |||
57 | -static const TypeInfo loongarch_pch_pic_info = { | ||
58 | - .name = TYPE_LOONGARCH_PCH_PIC, | ||
59 | - .parent = TYPE_SYS_BUS_DEVICE, | ||
60 | - .instance_size = sizeof(LoongArchPCHPIC), | ||
61 | - .class_init = loongarch_pch_pic_class_init, | ||
62 | +static const TypeInfo loongarch_pic_types[] = { | ||
63 | + { | ||
64 | + .name = TYPE_LOONGARCH_PIC, | ||
65 | + .parent = TYPE_LOONGARCH_PIC_COMMON, | ||
66 | + .instance_size = sizeof(LoongarchPICState), | ||
67 | + .class_size = sizeof(LoongarchPICClass), | ||
68 | + .class_init = loongarch_pic_class_init, | ||
69 | + } | ||
70 | }; | ||
71 | |||
72 | -static void loongarch_pch_pic_register_types(void) | ||
73 | -{ | ||
74 | - type_register_static(&loongarch_pch_pic_info); | ||
75 | -} | ||
76 | - | ||
77 | -type_init(loongarch_pch_pic_register_types) | ||
78 | +DEFINE_TYPES(loongarch_pic_types) | ||
79 | diff --git a/hw/intc/loongarch_pic_common.c b/hw/intc/loongarch_pic_common.c | ||
80 | index XXXXXXX..XXXXXXX 100644 | ||
81 | --- a/hw/intc/loongarch_pic_common.c | ||
82 | +++ b/hw/intc/loongarch_pic_common.c | ||
83 | @@ -XXX,XX +XXX,XX @@ | ||
84 | * Copyright (C) 2024 Loongson Technology Corporation Limited | ||
85 | */ | ||
86 | |||
87 | +#include "qemu/osdep.h" | ||
88 | +#include "qapi/error.h" | ||
89 | +#include "hw/intc/loongarch_pic_common.h" | ||
90 | +#include "hw/qdev-properties.h" | ||
91 | +#include "migration/vmstate.h" | ||
92 | + | ||
93 | static void loongarch_pic_common_realize(DeviceState *dev, Error **errp) | ||
94 | { | ||
95 | - LoongArchPICCommonState *s = LOONGARCH_PCH_PIC(dev); | ||
96 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(dev); | ||
97 | |||
98 | if (!s->irq_num || s->irq_num > VIRT_PCH_PIC_IRQ_NUM) { | ||
99 | error_setg(errp, "Invalid 'pic_irq_num'"); | ||
100 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_loongarch_pic_common = { | ||
101 | VMSTATE_END_OF_LIST() | ||
102 | } | ||
103 | }; | ||
104 | + | ||
105 | +static void loongarch_pic_common_class_init(ObjectClass *klass, void *data) | ||
106 | +{ | ||
107 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
108 | + LoongArchPICCommonClass *lpcc = LOONGARCH_PIC_COMMON_CLASS(klass); | ||
109 | + | ||
110 | + device_class_set_parent_realize(dc, loongarch_pic_common_realize, | ||
111 | + &lpcc->parent_realize); | ||
112 | + device_class_set_props(dc, loongarch_pic_common_properties); | ||
113 | + dc->vmsd = &vmstate_loongarch_pic_common; | ||
114 | +} | ||
115 | + | ||
116 | +static const TypeInfo loongarch_pic_common_types[] = { | ||
117 | + { | ||
118 | + .name = TYPE_LOONGARCH_PIC_COMMON, | ||
119 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
120 | + .instance_size = sizeof(LoongArchPICCommonState), | ||
121 | + .class_size = sizeof(LoongArchPICCommonClass), | ||
122 | + .class_init = loongarch_pic_common_class_init, | ||
123 | + .abstract = true, | ||
124 | + } | ||
125 | +}; | ||
126 | + | ||
127 | +DEFINE_TYPES(loongarch_pic_common_types) | ||
128 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build | ||
129 | index XXXXXXX..XXXXXXX 100644 | ||
130 | --- a/hw/intc/meson.build | ||
131 | +++ b/hw/intc/meson.build | ||
132 | @@ -XXX,XX +XXX,XX @@ specific_ss.add(when: 'CONFIG_M68K_IRQC', if_true: files('m68k_irqc.c')) | ||
133 | specific_ss.add(when: 'CONFIG_LOONGSON_IPI_COMMON', if_true: files('loongson_ipi_common.c')) | ||
134 | specific_ss.add(when: 'CONFIG_LOONGSON_IPI', if_true: files('loongson_ipi.c')) | ||
135 | specific_ss.add(when: 'CONFIG_LOONGARCH_IPI', if_true: files('loongarch_ipi.c')) | ||
136 | -specific_ss.add(when: 'CONFIG_LOONGARCH_PCH_PIC', if_true: files('loongarch_pch_pic.c')) | ||
137 | +specific_ss.add(when: 'CONFIG_LOONGARCH_PCH_PIC', if_true: files('loongarch_pch_pic.c', 'loongarch_pic_common.c')) | ||
138 | specific_ss.add(when: 'CONFIG_LOONGARCH_PCH_MSI', if_true: files('loongarch_pch_msi.c')) | ||
139 | specific_ss.add(when: 'CONFIG_LOONGARCH_EXTIOI', if_true: files('loongarch_extioi.c')) | ||
140 | diff --git a/include/hw/intc/loongarch_pch_pic.h b/include/hw/intc/loongarch_pch_pic.h | ||
141 | index XXXXXXX..XXXXXXX 100644 | ||
142 | --- a/include/hw/intc/loongarch_pch_pic.h | ||
143 | +++ b/include/hw/intc/loongarch_pch_pic.h | ||
144 | @@ -XXX,XX +XXX,XX @@ | ||
145 | |||
146 | #include "hw/intc/loongarch_pic_common.h" | ||
147 | |||
148 | -#define LoongArchPCHPIC LoongArchPICCommonState | ||
149 | -#define TYPE_LOONGARCH_PCH_PIC "loongarch_pch_pic" | ||
150 | -#define PCH_PIC_NAME(name) TYPE_LOONGARCH_PCH_PIC#name | ||
151 | -OBJECT_DECLARE_SIMPLE_TYPE(LoongArchPCHPIC, LOONGARCH_PCH_PIC) | ||
152 | +#define TYPE_LOONGARCH_PIC "loongarch_pic" | ||
153 | +#define PCH_PIC_NAME(name) TYPE_LOONGARCH_PIC#name | ||
154 | +OBJECT_DECLARE_TYPE(LoongarchPICState, LoongarchPICClass, LOONGARCH_PIC) | ||
155 | + | ||
156 | +struct LoongarchPICState { | ||
157 | + LoongArchPICCommonState parent_obj; | ||
158 | +}; | ||
159 | + | ||
160 | +struct LoongarchPICClass { | ||
161 | + LoongArchPICCommonClass parent_class; | ||
162 | + | ||
163 | + DeviceRealize parent_realize; | ||
164 | +}; | ||
165 | + | ||
166 | +#define TYPE_LOONGARCH_PCH_PIC TYPE_LOONGARCH_PIC | ||
167 | +typedef struct LoongArchPICCommonState LoongArchPCHPIC; | ||
168 | +#define LOONGARCH_PCH_PIC(obj) ((struct LoongArchPICCommonState *)(obj)) | ||
169 | |||
170 | #endif /* HW_LOONGARCH_PCH_PIC_H */ | ||
171 | diff --git a/include/hw/intc/loongarch_pic_common.h b/include/hw/intc/loongarch_pic_common.h | ||
172 | index XXXXXXX..XXXXXXX 100644 | ||
173 | --- a/include/hw/intc/loongarch_pic_common.h | ||
174 | +++ b/include/hw/intc/loongarch_pic_common.h | ||
175 | @@ -XXX,XX +XXX,XX @@ | ||
176 | #define POL_LO_START 0x40 | ||
177 | #define POL_HI_START 0x44 | ||
178 | |||
179 | +#define TYPE_LOONGARCH_PIC_COMMON "loongarch_pic_common" | ||
180 | +OBJECT_DECLARE_TYPE(LoongArchPICCommonState, | ||
181 | + LoongArchPICCommonClass, LOONGARCH_PIC_COMMON) | ||
182 | + | ||
183 | struct LoongArchPICCommonState { | ||
184 | SysBusDevice parent_obj; | ||
185 | |||
186 | @@ -XXX,XX +XXX,XX @@ struct LoongArchPICCommonState { | ||
187 | MemoryRegion iomem8; | ||
188 | unsigned int irq_num; | ||
189 | }; | ||
190 | + | ||
191 | +struct LoongArchPICCommonClass { | ||
192 | + SysBusDeviceClass parent_class; | ||
193 | + | ||
194 | + DeviceRealize parent_realize; | ||
195 | +}; | ||
196 | #endif /* HW_LOONGARCH_PIC_COMMON_H */ | ||
197 | -- | ||
198 | 2.43.5 | diff view generated by jsdifflib |
1 | From: Bibo Mao <maobibo@loongson.cn> | 1 | Add vmstate pre_save and post_load interfaces, which can be used |
---|---|---|---|
2 | 2 | by pic kvm driver in future. | |
3 | Add the support needed for creating prstatus elf notes. This allows | ||
4 | us to use QMP dump-guest-memory. | ||
5 | |||
6 | Now ELF notes of LoongArch only supports general elf notes, LSX and | ||
7 | LASX is not supported, since it is mainly used to dump guest memory. | ||
8 | 3 | ||
9 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | 4 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> |
10 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 5 | Reviewed-by: Song Gao <gaosong@loongson.cn> |
11 | Tested-by: Song Gao <gaosong@loongson.cn> | ||
12 | Message-Id: <20240822065245.2286214-1-maobibo@loongson.cn> | ||
13 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
14 | --- | 6 | --- |
15 | target/loongarch/arch_dump.c | 167 +++++++++++++++++++++++++++++++++++ | 7 | hw/intc/loongarch_pic_common.c | 26 ++++++++++++++++++++++++++ |
16 | target/loongarch/cpu.c | 1 + | 8 | include/hw/intc/loongarch_pic_common.h | 2 ++ |
17 | target/loongarch/internals.h | 2 + | 9 | 2 files changed, 28 insertions(+) |
18 | target/loongarch/meson.build | 1 + | ||
19 | 4 files changed, 171 insertions(+) | ||
20 | create mode 100644 target/loongarch/arch_dump.c | ||
21 | 10 | ||
22 | diff --git a/target/loongarch/arch_dump.c b/target/loongarch/arch_dump.c | 11 | diff --git a/hw/intc/loongarch_pic_common.c b/hw/intc/loongarch_pic_common.c |
23 | new file mode 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
24 | index XXXXXXX..XXXXXXX | 13 | --- a/hw/intc/loongarch_pic_common.c |
25 | --- /dev/null | 14 | +++ b/hw/intc/loongarch_pic_common.c |
26 | +++ b/target/loongarch/arch_dump.c | ||
27 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ |
28 | +/* | 16 | #include "hw/qdev-properties.h" |
29 | + * Support for writing ELF notes for LoongArch architectures | 17 | #include "migration/vmstate.h" |
30 | + * | 18 | |
31 | + * Copyright (c) 2023 Loongarch Technology | 19 | +static int loongarch_pic_pre_save(void *opaque) |
32 | + * | 20 | +{ |
33 | + * This program is free software; you can redistribute it and/or modify it | 21 | + LoongArchPICCommonState *s = (LoongArchPICCommonState *)opaque; |
34 | + * under the terms and conditions of the GNU General Public License, | 22 | + LoongArchPICCommonClass *lpcc = LOONGARCH_PIC_COMMON_GET_CLASS(s); |
35 | + * version 2 or later, as published by the Free Software Foundation. | ||
36 | + * | ||
37 | + * This program is distributed in the hope it will be useful, but WITHOUT | ||
38 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
39 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
40 | + * more details. | ||
41 | + * | ||
42 | + * You should have received a copy of the GNU General Public License along with | ||
43 | + * this program. If not, see <http://www.gnu.org/licenses/>. | ||
44 | + * | ||
45 | + */ | ||
46 | + | 23 | + |
47 | +#include "qemu/osdep.h" | 24 | + if (lpcc->pre_save) { |
48 | +#include "cpu.h" | 25 | + return lpcc->pre_save(s); |
49 | +#include "elf.h" | ||
50 | +#include "sysemu/dump.h" | ||
51 | +#include "internals.h" | ||
52 | + | ||
53 | +/* struct user_pt_regs from arch/loongarch/include/uapi/asm/ptrace.h */ | ||
54 | +struct loongarch_user_regs { | ||
55 | + uint64_t gpr[32]; | ||
56 | + uint64_t pad1[1]; | ||
57 | + /* Special CSR registers. */ | ||
58 | + uint64_t csr_era; | ||
59 | + uint64_t csr_badv; | ||
60 | + uint64_t pad2[10]; | ||
61 | +} QEMU_PACKED; | ||
62 | + | ||
63 | +QEMU_BUILD_BUG_ON(sizeof(struct loongarch_user_regs) != 360); | ||
64 | + | ||
65 | +/* struct elf_prstatus from include/uapi/linux/elfcore.h */ | ||
66 | +struct loongarch_elf_prstatus { | ||
67 | + char pad1[32]; /* 32 == offsetof(struct elf_prstatus, pr_pid) */ | ||
68 | + uint32_t pr_pid; | ||
69 | + /* | ||
70 | + * 76 == offsetof(struct elf_prstatus, pr_reg) - | ||
71 | + * offsetof(struct elf_prstatus, pr_ppid) | ||
72 | + */ | ||
73 | + char pad2[76]; | ||
74 | + struct loongarch_user_regs pr_reg; | ||
75 | + uint32_t pr_fpvalid; | ||
76 | + char pad3[4]; | ||
77 | +} QEMU_PACKED; | ||
78 | + | ||
79 | +QEMU_BUILD_BUG_ON(sizeof(struct loongarch_elf_prstatus) != 480); | ||
80 | + | ||
81 | +/* struct user_fp_state from arch/loongarch/include/uapi/asm/ptrace.h */ | ||
82 | +struct loongarch_fpu_struct { | ||
83 | + uint64_t fpr[32]; | ||
84 | + uint64_t fcc; | ||
85 | + unsigned int fcsr; | ||
86 | +} QEMU_PACKED; | ||
87 | + | ||
88 | +QEMU_BUILD_BUG_ON(sizeof(struct loongarch_fpu_struct) != 268); | ||
89 | + | ||
90 | +struct loongarch_note { | ||
91 | + Elf64_Nhdr hdr; | ||
92 | + char name[8]; /* align_up(sizeof("CORE"), 4) */ | ||
93 | + union { | ||
94 | + struct loongarch_elf_prstatus prstatus; | ||
95 | + struct loongarch_fpu_struct fpu; | ||
96 | + }; | ||
97 | +} QEMU_PACKED; | ||
98 | + | ||
99 | +#define LOONGARCH_NOTE_HEADER_SIZE offsetof(struct loongarch_note, prstatus) | ||
100 | +#define LOONGARCH_PRSTATUS_NOTE_SIZE \ | ||
101 | + (LOONGARCH_NOTE_HEADER_SIZE + sizeof(struct loongarch_elf_prstatus)) | ||
102 | +#define LOONGARCH_PRFPREG_NOTE_SIZE \ | ||
103 | + (LOONGARCH_NOTE_HEADER_SIZE + sizeof(struct loongarch_fpu_struct)) | ||
104 | + | ||
105 | +static void loongarch_note_init(struct loongarch_note *note, DumpState *s, | ||
106 | + const char *name, Elf64_Word namesz, | ||
107 | + Elf64_Word type, Elf64_Word descsz) | ||
108 | +{ | ||
109 | + memset(note, 0, sizeof(*note)); | ||
110 | + | ||
111 | + note->hdr.n_namesz = cpu_to_dump32(s, namesz); | ||
112 | + note->hdr.n_descsz = cpu_to_dump32(s, descsz); | ||
113 | + note->hdr.n_type = cpu_to_dump32(s, type); | ||
114 | + | ||
115 | + memcpy(note->name, name, namesz); | ||
116 | +} | ||
117 | + | ||
118 | +static int loongarch_write_elf64_fprpreg(WriteCoreDumpFunction f, | ||
119 | + CPULoongArchState *env, int cpuid, | ||
120 | + DumpState *s) | ||
121 | +{ | ||
122 | + struct loongarch_note note; | ||
123 | + int ret, i; | ||
124 | + | ||
125 | + loongarch_note_init(¬e, s, "CORE", 5, NT_PRFPREG, sizeof(note.fpu)); | ||
126 | + note.fpu.fcsr = cpu_to_dump64(s, env->fcsr0); | ||
127 | + | ||
128 | + for (i = 0; i < 8; i++) { | ||
129 | + note.fpu.fcc |= env->cf[i] << (8 * i); | ||
130 | + } | ||
131 | + note.fpu.fcc = cpu_to_dump64(s, note.fpu.fcc); | ||
132 | + | ||
133 | + for (i = 0; i < 32; ++i) { | ||
134 | + note.fpu.fpr[i] = cpu_to_dump64(s, env->fpr[i].vreg.UD[0]); | ||
135 | + } | ||
136 | + | ||
137 | + ret = f(¬e, LOONGARCH_PRFPREG_NOTE_SIZE, s); | ||
138 | + if (ret < 0) { | ||
139 | + return -1; | ||
140 | + } | 26 | + } |
141 | + | 27 | + |
142 | + return 0; | 28 | + return 0; |
143 | +} | 29 | +} |
144 | + | 30 | + |
145 | +int loongarch_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs, | 31 | +static int loongarch_pic_post_load(void *opaque, int version_id) |
146 | + int cpuid, DumpState *s) | ||
147 | +{ | 32 | +{ |
148 | + struct loongarch_note note; | 33 | + LoongArchPICCommonState *s = (LoongArchPICCommonState *)opaque; |
149 | + CPULoongArchState *env = &LOONGARCH_CPU(cs)->env; | 34 | + LoongArchPICCommonClass *lpcc = LOONGARCH_PIC_COMMON_GET_CLASS(s); |
150 | + int ret, i; | ||
151 | + | 35 | + |
152 | + loongarch_note_init(¬e, s, "CORE", 5, NT_PRSTATUS, | 36 | + if (lpcc->post_load) { |
153 | + sizeof(note.prstatus)); | 37 | + return lpcc->post_load(s, version_id); |
154 | + note.prstatus.pr_pid = cpu_to_dump32(s, cpuid); | ||
155 | + note.prstatus.pr_fpvalid = cpu_to_dump32(s, 1); | ||
156 | + | ||
157 | + for (i = 0; i < 32; ++i) { | ||
158 | + note.prstatus.pr_reg.gpr[i] = cpu_to_dump64(s, env->gpr[i]); | ||
159 | + } | 38 | + } |
160 | + note.prstatus.pr_reg.csr_era = cpu_to_dump64(s, env->CSR_ERA); | ||
161 | + note.prstatus.pr_reg.csr_badv = cpu_to_dump64(s, env->CSR_BADV); | ||
162 | + ret = f(¬e, LOONGARCH_PRSTATUS_NOTE_SIZE, s); | ||
163 | + if (ret < 0) { | ||
164 | + return -1; | ||
165 | + } | ||
166 | + | ||
167 | + ret = loongarch_write_elf64_fprpreg(f, env, cpuid, s); | ||
168 | + if (ret < 0) { | ||
169 | + return -1; | ||
170 | + } | ||
171 | + | ||
172 | + return ret; | ||
173 | +} | ||
174 | + | ||
175 | +int cpu_get_dump_info(ArchDumpInfo *info, | ||
176 | + const GuestPhysBlockList *guest_phys_blocks) | ||
177 | +{ | ||
178 | + info->d_machine = EM_LOONGARCH; | ||
179 | + info->d_endian = ELFDATA2LSB; | ||
180 | + info->d_class = ELFCLASS64; | ||
181 | + | 39 | + |
182 | + return 0; | 40 | + return 0; |
183 | +} | 41 | +} |
184 | + | 42 | + |
185 | +ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) | 43 | static void loongarch_pic_common_realize(DeviceState *dev, Error **errp) |
186 | +{ | 44 | { |
187 | + size_t note_size = 0; | 45 | LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(dev); |
188 | + | 46 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_loongarch_pic_common = { |
189 | + if (class == ELFCLASS64) { | 47 | .name = "loongarch_pch_pic", |
190 | + note_size = LOONGARCH_PRSTATUS_NOTE_SIZE + LOONGARCH_PRFPREG_NOTE_SIZE; | 48 | .version_id = 1, |
191 | + } | 49 | .minimum_version_id = 1, |
192 | + | 50 | + .pre_save = loongarch_pic_pre_save, |
193 | + return note_size * nr_cpus; | 51 | + .post_load = loongarch_pic_post_load, |
194 | +} | 52 | .fields = (const VMStateField[]) { |
195 | diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c | 53 | VMSTATE_UINT64(int_mask, LoongArchPICCommonState), |
54 | VMSTATE_UINT64(htmsi_en, LoongArchPICCommonState), | ||
55 | diff --git a/include/hw/intc/loongarch_pic_common.h b/include/hw/intc/loongarch_pic_common.h | ||
196 | index XXXXXXX..XXXXXXX 100644 | 56 | index XXXXXXX..XXXXXXX 100644 |
197 | --- a/target/loongarch/cpu.c | 57 | --- a/include/hw/intc/loongarch_pic_common.h |
198 | +++ b/target/loongarch/cpu.c | 58 | +++ b/include/hw/intc/loongarch_pic_common.h |
199 | @@ -XXX,XX +XXX,XX @@ static const TCGCPUOps loongarch_tcg_ops = { | 59 | @@ -XXX,XX +XXX,XX @@ struct LoongArchPICCommonClass { |
200 | #include "hw/core/sysemu-cpu-ops.h" | 60 | SysBusDeviceClass parent_class; |
201 | 61 | ||
202 | static const struct SysemuCPUOps loongarch_sysemu_ops = { | 62 | DeviceRealize parent_realize; |
203 | + .write_elf64_note = loongarch_cpu_write_elf64_note, | 63 | + int (*pre_save)(LoongArchPICCommonState *s); |
204 | .get_phys_page_debug = loongarch_cpu_get_phys_page_debug, | 64 | + int (*post_load)(LoongArchPICCommonState *s, int version_id); |
205 | }; | 65 | }; |
206 | 66 | #endif /* HW_LOONGARCH_PIC_COMMON_H */ | |
207 | diff --git a/target/loongarch/internals.h b/target/loongarch/internals.h | ||
208 | index XXXXXXX..XXXXXXX 100644 | ||
209 | --- a/target/loongarch/internals.h | ||
210 | +++ b/target/loongarch/internals.h | ||
211 | @@ -XXX,XX +XXX,XX @@ void write_fcc(CPULoongArchState *env, uint64_t val); | ||
212 | int loongarch_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n); | ||
213 | int loongarch_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n); | ||
214 | void loongarch_cpu_register_gdb_regs_for_features(CPUState *cs); | ||
215 | +int loongarch_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu, | ||
216 | + int cpuid, DumpState *s); | ||
217 | |||
218 | #endif | ||
219 | diff --git a/target/loongarch/meson.build b/target/loongarch/meson.build | ||
220 | index XXXXXXX..XXXXXXX 100644 | ||
221 | --- a/target/loongarch/meson.build | ||
222 | +++ b/target/loongarch/meson.build | ||
223 | @@ -XXX,XX +XXX,XX @@ loongarch_ss.add(files( | ||
224 | |||
225 | loongarch_system_ss = ss.source_set() | ||
226 | loongarch_system_ss.add(files( | ||
227 | + 'arch_dump.c', | ||
228 | 'cpu_helper.c', | ||
229 | 'loongarch-qmp-cmds.c', | ||
230 | 'machine.c', | ||
231 | -- | 67 | -- |
232 | 2.34.1 | 68 | 2.43.5 | diff view generated by jsdifflib |
1 | From: "Jason A. Donenfeld" <Jason@zx2c4.com> | 1 | Remove definition about LoongArchPCHPIC and LOONGARCH_PCH_PIC, and |
---|---|---|---|
2 | replace them with LoongArchPICCommonState and LOONGARCH_PIC_COMMON | ||
3 | separately. Also remove unnecessary header files. | ||
2 | 4 | ||
3 | If the FDT contains /chosen/rng-seed, then the Linux RNG will use it to | 5 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> |
4 | initialize early. Set this using the usual guest random number | 6 | Reviewed-by: Song Gao <gaosong@loongson.cn> |
5 | generation function. | 7 | --- |
8 | hw/intc/loongarch_pch_pic.c | 24 ++++++++++-------------- | ||
9 | hw/loongarch/virt.c | 2 +- | ||
10 | include/hw/intc/loongarch_pch_pic.h | 4 ---- | ||
11 | 3 files changed, 11 insertions(+), 19 deletions(-) | ||
6 | 12 | ||
7 | This is the same procedure that's done in b91b6b5a2c ("hw/microblaze: | 13 | diff --git a/hw/intc/loongarch_pch_pic.c b/hw/intc/loongarch_pch_pic.c |
8 | pass random seed to fdt"), e4b4f0b71c ("hw/riscv: virt: pass random seed | 14 | index XXXXXXX..XXXXXXX 100644 |
9 | to fdt"), c6fe3e6b4c ("hw/openrisc: virt: pass random seed to fdt"), | 15 | --- a/hw/intc/loongarch_pch_pic.c |
10 | 67f7e426e5 ("hw/i386: pass RNG seed via setup_data entry"), c287941a4d | 16 | +++ b/hw/intc/loongarch_pch_pic.c |
11 | ("hw/rx: pass random seed to fdt"), 5e19cc68fb ("hw/mips: boston: pass | 17 | @@ -XXX,XX +XXX,XX @@ |
12 | random seed to fdt"), 6b23a67916 ("hw/nios2: virt: pass random seed to fdt") | 18 | |
13 | c4b075318e ("hw/ppc: pass random seed to fdt"), and 5242876f37 | 19 | #include "qemu/osdep.h" |
14 | ("hw/arm/virt: dt: add rng-seed property"). | 20 | #include "qemu/bitops.h" |
15 | 21 | -#include "hw/sysbus.h" | |
16 | These earlier commits later were amended to rerandomize the RNG seed on | 22 | -#include "hw/loongarch/virt.h" |
17 | snapshot load, but the LoongArch code somehow already does that, despite | 23 | -#include "hw/pci-host/ls7a.h" |
18 | not having this patch here, presumably due to some lucky copy and | 24 | #include "hw/irq.h" |
19 | pasting. | 25 | #include "hw/intc/loongarch_pch_pic.h" |
20 | 26 | -#include "hw/qdev-properties.h" | |
21 | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> | 27 | -#include "migration/vmstate.h" |
22 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 28 | #include "trace.h" |
23 | Message-Id: <20240905153316.2038769-1-Jason@zx2c4.com> | 29 | #include "qapi/error.h" |
24 | Signed-off-by: Song Gao <gaosong@loongson.cn> | 30 | |
25 | --- | 31 | -static void pch_pic_update_irq(LoongArchPCHPIC *s, uint64_t mask, int level) |
26 | hw/loongarch/virt.c | 6 ++++++ | 32 | +static void pch_pic_update_irq(LoongArchPICCommonState *s, uint64_t mask, |
27 | 1 file changed, 6 insertions(+) | 33 | + int level) |
28 | 34 | { | |
35 | uint64_t val; | ||
36 | int irq; | ||
37 | @@ -XXX,XX +XXX,XX @@ static void pch_pic_update_irq(LoongArchPCHPIC *s, uint64_t mask, int level) | ||
38 | |||
39 | static void pch_pic_irq_handler(void *opaque, int irq, int level) | ||
40 | { | ||
41 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | ||
42 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque); | ||
43 | uint64_t mask = 1ULL << irq; | ||
44 | |||
45 | assert(irq < s->irq_num); | ||
46 | @@ -XXX,XX +XXX,XX @@ static void pch_pic_irq_handler(void *opaque, int irq, int level) | ||
47 | static uint64_t loongarch_pch_pic_low_readw(void *opaque, hwaddr addr, | ||
48 | unsigned size) | ||
49 | { | ||
50 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | ||
51 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque); | ||
52 | uint64_t val = 0; | ||
53 | uint32_t offset = addr & 0xfff; | ||
54 | |||
55 | @@ -XXX,XX +XXX,XX @@ static uint64_t get_writew_val(uint64_t value, uint32_t target, bool hi) | ||
56 | static void loongarch_pch_pic_low_writew(void *opaque, hwaddr addr, | ||
57 | uint64_t value, unsigned size) | ||
58 | { | ||
59 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | ||
60 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque); | ||
61 | uint32_t offset, old_valid, data = (uint32_t)value; | ||
62 | uint64_t old, int_mask; | ||
63 | offset = addr & 0xfff; | ||
64 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_low_writew(void *opaque, hwaddr addr, | ||
65 | static uint64_t loongarch_pch_pic_high_readw(void *opaque, hwaddr addr, | ||
66 | unsigned size) | ||
67 | { | ||
68 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | ||
69 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque); | ||
70 | uint64_t val = 0; | ||
71 | uint32_t offset = addr & 0xfff; | ||
72 | |||
73 | @@ -XXX,XX +XXX,XX @@ static uint64_t loongarch_pch_pic_high_readw(void *opaque, hwaddr addr, | ||
74 | static void loongarch_pch_pic_high_writew(void *opaque, hwaddr addr, | ||
75 | uint64_t value, unsigned size) | ||
76 | { | ||
77 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | ||
78 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque); | ||
79 | uint32_t offset, data = (uint32_t)value; | ||
80 | offset = addr & 0xfff; | ||
81 | |||
82 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_high_writew(void *opaque, hwaddr addr, | ||
83 | static uint64_t loongarch_pch_pic_readb(void *opaque, hwaddr addr, | ||
84 | unsigned size) | ||
85 | { | ||
86 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | ||
87 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque); | ||
88 | uint64_t val = 0; | ||
89 | uint32_t offset = (addr & 0xfff) + PCH_PIC_ROUTE_ENTRY_OFFSET; | ||
90 | int64_t offset_tmp; | ||
91 | @@ -XXX,XX +XXX,XX @@ static uint64_t loongarch_pch_pic_readb(void *opaque, hwaddr addr, | ||
92 | static void loongarch_pch_pic_writeb(void *opaque, hwaddr addr, | ||
93 | uint64_t data, unsigned size) | ||
94 | { | ||
95 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | ||
96 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque); | ||
97 | int32_t offset_tmp; | ||
98 | uint32_t offset = (addr & 0xfff) + PCH_PIC_ROUTE_ENTRY_OFFSET; | ||
99 | |||
100 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps loongarch_pch_pic_reg8_ops = { | ||
101 | |||
102 | static void loongarch_pch_pic_reset(DeviceState *d) | ||
103 | { | ||
104 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(d); | ||
105 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(d); | ||
106 | int i; | ||
107 | |||
108 | s->int_mask = -1; | ||
29 | diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c | 109 | diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c |
30 | index XXXXXXX..XXXXXXX 100644 | 110 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/hw/loongarch/virt.c | 111 | --- a/hw/loongarch/virt.c |
32 | +++ b/hw/loongarch/virt.c | 112 | +++ b/hw/loongarch/virt.c |
33 | @@ -XXX,XX +XXX,XX @@ | 113 | @@ -XXX,XX +XXX,XX @@ static void virt_irq_init(LoongArchVirtMachineState *lvms) |
34 | #include "hw/block/flash.h" | 114 | /* Add Extend I/O Interrupt Controller node */ |
35 | #include "hw/virtio/virtio-iommu.h" | 115 | fdt_add_eiointc_node(lvms, &cpuintc_phandle, &eiointc_phandle); |
36 | #include "qemu/error-report.h" | 116 | |
37 | +#include "qemu/guest-random.h" | 117 | - pch_pic = qdev_new(TYPE_LOONGARCH_PCH_PIC); |
38 | 118 | + pch_pic = qdev_new(TYPE_LOONGARCH_PIC); | |
39 | static bool virt_is_veiointc_enabled(LoongArchVirtMachineState *lvms) | 119 | num = VIRT_PCH_PIC_IRQ_NUM; |
40 | { | 120 | qdev_prop_set_uint32(pch_pic, "pch_pic_irq_num", num); |
41 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_uart_node(LoongArchVirtMachineState *lvms, | 121 | d = SYS_BUS_DEVICE(pch_pic); |
42 | static void create_fdt(LoongArchVirtMachineState *lvms) | 122 | diff --git a/include/hw/intc/loongarch_pch_pic.h b/include/hw/intc/loongarch_pch_pic.h |
43 | { | 123 | index XXXXXXX..XXXXXXX 100644 |
44 | MachineState *ms = MACHINE(lvms); | 124 | --- a/include/hw/intc/loongarch_pch_pic.h |
45 | + uint8_t rng_seed[32]; | 125 | +++ b/include/hw/intc/loongarch_pch_pic.h |
46 | 126 | @@ -XXX,XX +XXX,XX @@ struct LoongarchPICClass { | |
47 | ms->fdt = create_device_tree(&lvms->fdt_size); | 127 | DeviceRealize parent_realize; |
48 | if (!ms->fdt) { | 128 | }; |
49 | @@ -XXX,XX +XXX,XX @@ static void create_fdt(LoongArchVirtMachineState *lvms) | 129 | |
50 | qemu_fdt_setprop_cell(ms->fdt, "/", "#address-cells", 0x2); | 130 | -#define TYPE_LOONGARCH_PCH_PIC TYPE_LOONGARCH_PIC |
51 | qemu_fdt_setprop_cell(ms->fdt, "/", "#size-cells", 0x2); | 131 | -typedef struct LoongArchPICCommonState LoongArchPCHPIC; |
52 | qemu_fdt_add_subnode(ms->fdt, "/chosen"); | 132 | -#define LOONGARCH_PCH_PIC(obj) ((struct LoongArchPICCommonState *)(obj)) |
53 | + | 133 | - |
54 | + /* Pass seed to RNG */ | 134 | #endif /* HW_LOONGARCH_PCH_PIC_H */ |
55 | + qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed)); | ||
56 | + qemu_fdt_setprop(ms->fdt, "/chosen", "rng-seed", rng_seed, sizeof(rng_seed)); | ||
57 | } | ||
58 | |||
59 | static void fdt_add_cpu_nodes(const LoongArchVirtMachineState *lvms) | ||
60 | -- | 135 | -- |
61 | 2.34.1 | 136 | 2.43.5 | diff view generated by jsdifflib |
1 | From: Bibo Mao <maobibo@loongson.cn> | 1 | Add common header file include/hw/intc/loongarch_extioi_common.h, and |
---|---|---|---|
2 | 2 | move some macro definition from include/hw/intc/loongarch_extioi.h to | |
3 | For virtio VGA deivce libvirt will select VIRTIO_VGA firstly rather than | 3 | the common header file. |
4 | VIRTIO_GPU, VIRTIO_VGA device supports frame buffer however it requires | ||
5 | legacy VGA compatible support. Frame buffer area 0xa0000 -- 0xc0000 | ||
6 | conflicts with low memory area 0 -- 0x10000000. | ||
7 | |||
8 | Here remove default support for VIRTIO_VGA device, VIRTIO_GPU is prefered | ||
9 | on LoongArch system. For frame buffer video card support, standard VGA can | ||
10 | be used. | ||
11 | 4 | ||
12 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | 5 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> |
13 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 6 | Reviewed-by: Song Gao <gaosong@loongson.cn> |
14 | Message-Id: <20240823073050.2619484-1-maobibo@loongson.cn> | ||
15 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
16 | --- | 7 | --- |
17 | hw/loongarch/Kconfig | 1 - | 8 | include/hw/intc/loongarch_extioi.h | 50 +------------------ |
18 | 1 file changed, 1 deletion(-) | 9 | include/hw/intc/loongarch_extioi_common.h | 58 +++++++++++++++++++++++ |
10 | 2 files changed, 59 insertions(+), 49 deletions(-) | ||
11 | create mode 100644 include/hw/intc/loongarch_extioi_common.h | ||
19 | 12 | ||
20 | diff --git a/hw/loongarch/Kconfig b/hw/loongarch/Kconfig | 13 | diff --git a/include/hw/intc/loongarch_extioi.h b/include/hw/intc/loongarch_extioi.h |
21 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/loongarch/Kconfig | 15 | --- a/include/hw/intc/loongarch_extioi.h |
23 | +++ b/hw/loongarch/Kconfig | 16 | +++ b/include/hw/intc/loongarch_extioi.h |
24 | @@ -XXX,XX +XXX,XX @@ config LOONGARCH_VIRT | 17 | @@ -XXX,XX +XXX,XX @@ |
25 | select DEVICE_TREE | 18 | * Copyright (C) 2021 Loongson Technology Corporation Limited |
26 | select PCI | 19 | */ |
27 | select PCI_EXPRESS_GENERIC_BRIDGE | 20 | |
28 | - imply VIRTIO_VGA | 21 | -#include "hw/sysbus.h" |
29 | imply PCI_DEVICES | 22 | -#include "hw/loongarch/virt.h" |
30 | imply NVDIMM | 23 | - |
31 | imply TPM_TIS_SYSBUS | 24 | #ifndef LOONGARCH_EXTIOI_H |
25 | #define LOONGARCH_EXTIOI_H | ||
26 | |||
27 | -#define LS3A_INTC_IP 8 | ||
28 | -#define EXTIOI_IRQS (256) | ||
29 | -#define EXTIOI_IRQS_BITMAP_SIZE (256 / 8) | ||
30 | -/* irq from EXTIOI is routed to no more than 4 cpus */ | ||
31 | -#define EXTIOI_CPUS (4) | ||
32 | -/* map to ipnum per 32 irqs */ | ||
33 | -#define EXTIOI_IRQS_IPMAP_SIZE (256 / 32) | ||
34 | -#define EXTIOI_IRQS_COREMAP_SIZE 256 | ||
35 | -#define EXTIOI_IRQS_NODETYPE_COUNT 16 | ||
36 | -#define EXTIOI_IRQS_GROUP_COUNT 8 | ||
37 | - | ||
38 | -#define APIC_OFFSET 0x400 | ||
39 | -#define APIC_BASE (0x1000ULL + APIC_OFFSET) | ||
40 | - | ||
41 | -#define EXTIOI_NODETYPE_START (0x4a0 - APIC_OFFSET) | ||
42 | -#define EXTIOI_NODETYPE_END (0x4c0 - APIC_OFFSET) | ||
43 | -#define EXTIOI_IPMAP_START (0x4c0 - APIC_OFFSET) | ||
44 | -#define EXTIOI_IPMAP_END (0x4c8 - APIC_OFFSET) | ||
45 | -#define EXTIOI_ENABLE_START (0x600 - APIC_OFFSET) | ||
46 | -#define EXTIOI_ENABLE_END (0x620 - APIC_OFFSET) | ||
47 | -#define EXTIOI_BOUNCE_START (0x680 - APIC_OFFSET) | ||
48 | -#define EXTIOI_BOUNCE_END (0x6a0 - APIC_OFFSET) | ||
49 | -#define EXTIOI_ISR_START (0x700 - APIC_OFFSET) | ||
50 | -#define EXTIOI_ISR_END (0x720 - APIC_OFFSET) | ||
51 | -#define EXTIOI_COREISR_START (0x800 - APIC_OFFSET) | ||
52 | -#define EXTIOI_COREISR_END (0xB20 - APIC_OFFSET) | ||
53 | -#define EXTIOI_COREMAP_START (0xC00 - APIC_OFFSET) | ||
54 | -#define EXTIOI_COREMAP_END (0xD00 - APIC_OFFSET) | ||
55 | -#define EXTIOI_SIZE 0x800 | ||
56 | - | ||
57 | -#define EXTIOI_VIRT_BASE (0x40000000) | ||
58 | -#define EXTIOI_VIRT_SIZE (0x1000) | ||
59 | -#define EXTIOI_VIRT_FEATURES (0x0) | ||
60 | -#define EXTIOI_HAS_VIRT_EXTENSION (0) | ||
61 | -#define EXTIOI_HAS_ENABLE_OPTION (1) | ||
62 | -#define EXTIOI_HAS_INT_ENCODE (2) | ||
63 | -#define EXTIOI_HAS_CPU_ENCODE (3) | ||
64 | -#define EXTIOI_VIRT_HAS_FEATURES (BIT(EXTIOI_HAS_VIRT_EXTENSION) \ | ||
65 | - | BIT(EXTIOI_HAS_ENABLE_OPTION) \ | ||
66 | - | BIT(EXTIOI_HAS_CPU_ENCODE)) | ||
67 | -#define EXTIOI_VIRT_CONFIG (0x4) | ||
68 | -#define EXTIOI_ENABLE (1) | ||
69 | -#define EXTIOI_ENABLE_INT_ENCODE (2) | ||
70 | -#define EXTIOI_ENABLE_CPU_ENCODE (3) | ||
71 | -#define EXTIOI_VIRT_COREMAP_START (0x40) | ||
72 | -#define EXTIOI_VIRT_COREMAP_END (0x240) | ||
73 | +#include "hw/intc/loongarch_extioi_common.h" | ||
74 | |||
75 | typedef struct ExtIOICore { | ||
76 | uint32_t coreisr[EXTIOI_IRQS_GROUP_COUNT]; | ||
77 | diff --git a/include/hw/intc/loongarch_extioi_common.h b/include/hw/intc/loongarch_extioi_common.h | ||
78 | new file mode 100644 | ||
79 | index XXXXXXX..XXXXXXX | ||
80 | --- /dev/null | ||
81 | +++ b/include/hw/intc/loongarch_extioi_common.h | ||
82 | @@ -XXX,XX +XXX,XX @@ | ||
83 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
84 | +/* | ||
85 | + * LoongArch 3A5000 ext interrupt controller definitions | ||
86 | + * Copyright (C) 2024 Loongson Technology Corporation Limited | ||
87 | + */ | ||
88 | + | ||
89 | +#ifndef LOONGARCH_EXTIOI_COMMON_H | ||
90 | +#define LOONGARCH_EXTIOI_COMMON_H | ||
91 | + | ||
92 | +#include "hw/sysbus.h" | ||
93 | +#include "hw/loongarch/virt.h" | ||
94 | + | ||
95 | +#define LS3A_INTC_IP 8 | ||
96 | +#define EXTIOI_IRQS (256) | ||
97 | +#define EXTIOI_IRQS_BITMAP_SIZE (256 / 8) | ||
98 | +/* irq from EXTIOI is routed to no more than 4 cpus */ | ||
99 | +#define EXTIOI_CPUS (4) | ||
100 | +/* map to ipnum per 32 irqs */ | ||
101 | +#define EXTIOI_IRQS_IPMAP_SIZE (256 / 32) | ||
102 | +#define EXTIOI_IRQS_COREMAP_SIZE 256 | ||
103 | +#define EXTIOI_IRQS_NODETYPE_COUNT 16 | ||
104 | +#define EXTIOI_IRQS_GROUP_COUNT 8 | ||
105 | + | ||
106 | +#define APIC_OFFSET 0x400 | ||
107 | +#define APIC_BASE (0x1000ULL + APIC_OFFSET) | ||
108 | +#define EXTIOI_NODETYPE_START (0x4a0 - APIC_OFFSET) | ||
109 | +#define EXTIOI_NODETYPE_END (0x4c0 - APIC_OFFSET) | ||
110 | +#define EXTIOI_IPMAP_START (0x4c0 - APIC_OFFSET) | ||
111 | +#define EXTIOI_IPMAP_END (0x4c8 - APIC_OFFSET) | ||
112 | +#define EXTIOI_ENABLE_START (0x600 - APIC_OFFSET) | ||
113 | +#define EXTIOI_ENABLE_END (0x620 - APIC_OFFSET) | ||
114 | +#define EXTIOI_BOUNCE_START (0x680 - APIC_OFFSET) | ||
115 | +#define EXTIOI_BOUNCE_END (0x6a0 - APIC_OFFSET) | ||
116 | +#define EXTIOI_ISR_START (0x700 - APIC_OFFSET) | ||
117 | +#define EXTIOI_ISR_END (0x720 - APIC_OFFSET) | ||
118 | +#define EXTIOI_COREISR_START (0x800 - APIC_OFFSET) | ||
119 | +#define EXTIOI_COREISR_END (0xB20 - APIC_OFFSET) | ||
120 | +#define EXTIOI_COREMAP_START (0xC00 - APIC_OFFSET) | ||
121 | +#define EXTIOI_COREMAP_END (0xD00 - APIC_OFFSET) | ||
122 | +#define EXTIOI_SIZE 0x800 | ||
123 | + | ||
124 | +#define EXTIOI_VIRT_BASE (0x40000000) | ||
125 | +#define EXTIOI_VIRT_SIZE (0x1000) | ||
126 | +#define EXTIOI_VIRT_FEATURES (0x0) | ||
127 | +#define EXTIOI_HAS_VIRT_EXTENSION (0) | ||
128 | +#define EXTIOI_HAS_ENABLE_OPTION (1) | ||
129 | +#define EXTIOI_HAS_INT_ENCODE (2) | ||
130 | +#define EXTIOI_HAS_CPU_ENCODE (3) | ||
131 | +#define EXTIOI_VIRT_HAS_FEATURES (BIT(EXTIOI_HAS_VIRT_EXTENSION) \ | ||
132 | + | BIT(EXTIOI_HAS_ENABLE_OPTION) \ | ||
133 | + | BIT(EXTIOI_HAS_CPU_ENCODE)) | ||
134 | +#define EXTIOI_VIRT_CONFIG (0x4) | ||
135 | +#define EXTIOI_ENABLE (1) | ||
136 | +#define EXTIOI_ENABLE_INT_ENCODE (2) | ||
137 | +#define EXTIOI_ENABLE_CPU_ENCODE (3) | ||
138 | +#define EXTIOI_VIRT_COREMAP_START (0x40) | ||
139 | +#define EXTIOI_VIRT_COREMAP_END (0x240) | ||
140 | +#endif /* LOONGARCH_EXTIOI_H */ | ||
32 | -- | 141 | -- |
33 | 2.34.1 | 142 | 2.43.5 | diff view generated by jsdifflib |
1 | From: "Jason A. Donenfeld" <Jason@zx2c4.com> | 1 | Move definiton of structure LoongArchExtIOI from header file loongarch_extioi.h |
---|---|---|---|
2 | to file loongarch_extioi_common.h. | ||
2 | 3 | ||
3 | In order to support additional channels of communication using | 4 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> |
4 | `-serial`, add several serial ports, up to the standard 4 generally | 5 | Reviewed-by: Song Gao <gaosong@loongson.cn> |
5 | supported by the 8250 driver. | 6 | --- |
7 | include/hw/intc/loongarch_extioi.h | 26 ---------------------- | ||
8 | include/hw/intc/loongarch_extioi_common.h | 27 +++++++++++++++++++++++ | ||
9 | 2 files changed, 27 insertions(+), 26 deletions(-) | ||
6 | 10 | ||
7 | Fixed: https://lore.kernel.org/all/20240907143439.2792924-1-Jason@zx2c4.com/ | 11 | diff --git a/include/hw/intc/loongarch_extioi.h b/include/hw/intc/loongarch_extioi.h |
8 | |||
9 | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> | ||
10 | Tested-by: Bibo Mao <maobibo@loongson.cn> | ||
11 | [gaosong: ACPI uart need't reverse order] | ||
12 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
13 | Message-Id: <20240907143439.2792924-1-Jason@zx2c4.com> | ||
14 | --- | ||
15 | hw/loongarch/acpi-build.c | 23 +++++++++++++++-------- | ||
16 | hw/loongarch/virt.c | 27 +++++++++++++++++---------- | ||
17 | include/hw/pci-host/ls7a.h | 9 +++++---- | ||
18 | 3 files changed, 37 insertions(+), 22 deletions(-) | ||
19 | |||
20 | diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/loongarch/acpi-build.c | 13 | --- a/include/hw/intc/loongarch_extioi.h |
23 | +++ b/hw/loongarch/acpi-build.c | 14 | +++ b/include/hw/intc/loongarch_extioi.h |
24 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ |
25 | 16 | ||
26 | #include "hw/acpi/generic_event_device.h" | 17 | #include "hw/intc/loongarch_extioi_common.h" |
27 | #include "hw/pci-host/gpex.h" | 18 | |
28 | +#include "sysemu/sysemu.h" | 19 | -typedef struct ExtIOICore { |
29 | #include "sysemu/tpm.h" | 20 | - uint32_t coreisr[EXTIOI_IRQS_GROUP_COUNT]; |
30 | #include "hw/platform-bus.h" | 21 | - DECLARE_BITMAP(sw_isr[LS3A_INTC_IP], EXTIOI_IRQS); |
31 | #include "hw/acpi/aml-build.h" | 22 | - qemu_irq parent_irq[LS3A_INTC_IP]; |
32 | @@ -XXX,XX +XXX,XX @@ struct AcpiBuildState { | 23 | -} ExtIOICore; |
33 | MemoryRegion *linker_mr; | ||
34 | } AcpiBuildState; | ||
35 | |||
36 | -static void build_uart_device_aml(Aml *table) | ||
37 | +static void build_uart_device_aml(Aml *table, int index) | ||
38 | { | ||
39 | Aml *dev; | ||
40 | Aml *crs; | ||
41 | Aml *pkg0, *pkg1, *pkg2; | ||
42 | - uint32_t uart_irq = VIRT_UART_IRQ; | ||
43 | - | 24 | - |
44 | - Aml *scope = aml_scope("_SB"); | 25 | #define TYPE_LOONGARCH_EXTIOI "loongarch.extioi" |
45 | - dev = aml_device("COMA"); | 26 | OBJECT_DECLARE_SIMPLE_TYPE(LoongArchExtIOI, LOONGARCH_EXTIOI) |
46 | + Aml *scope; | 27 | -struct LoongArchExtIOI { |
47 | + uint32_t uart_irq; | 28 | - SysBusDevice parent_obj; |
48 | + uint64_t base; | 29 | - uint32_t num_cpu; |
30 | - uint32_t features; | ||
31 | - uint32_t status; | ||
32 | - /* hardware state */ | ||
33 | - uint32_t nodetype[EXTIOI_IRQS_NODETYPE_COUNT / 2]; | ||
34 | - uint32_t bounce[EXTIOI_IRQS_GROUP_COUNT]; | ||
35 | - uint32_t isr[EXTIOI_IRQS / 32]; | ||
36 | - uint32_t enable[EXTIOI_IRQS / 32]; | ||
37 | - uint32_t ipmap[EXTIOI_IRQS_IPMAP_SIZE / 4]; | ||
38 | - uint32_t coremap[EXTIOI_IRQS / 4]; | ||
39 | - uint32_t sw_pending[EXTIOI_IRQS / 32]; | ||
40 | - uint8_t sw_ipmap[EXTIOI_IRQS_IPMAP_SIZE]; | ||
41 | - uint8_t sw_coremap[EXTIOI_IRQS]; | ||
42 | - qemu_irq irq[EXTIOI_IRQS]; | ||
43 | - ExtIOICore *cpu; | ||
44 | - MemoryRegion extioi_system_mem; | ||
45 | - MemoryRegion virt_extend; | ||
46 | -}; | ||
47 | #endif /* LOONGARCH_EXTIOI_H */ | ||
48 | diff --git a/include/hw/intc/loongarch_extioi_common.h b/include/hw/intc/loongarch_extioi_common.h | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/include/hw/intc/loongarch_extioi_common.h | ||
51 | +++ b/include/hw/intc/loongarch_extioi_common.h | ||
52 | @@ -XXX,XX +XXX,XX @@ | ||
53 | #define EXTIOI_ENABLE_CPU_ENCODE (3) | ||
54 | #define EXTIOI_VIRT_COREMAP_START (0x40) | ||
55 | #define EXTIOI_VIRT_COREMAP_END (0x240) | ||
49 | + | 56 | + |
50 | + uart_irq = VIRT_UART_IRQ + index; | 57 | +typedef struct ExtIOICore { |
51 | + base = VIRT_UART_BASE + index * VIRT_UART_SIZE; | 58 | + uint32_t coreisr[EXTIOI_IRQS_GROUP_COUNT]; |
52 | + scope = aml_scope("_SB"); | 59 | + DECLARE_BITMAP(sw_isr[LS3A_INTC_IP], EXTIOI_IRQS); |
53 | + dev = aml_device("COM%d", index); | 60 | + qemu_irq parent_irq[LS3A_INTC_IP]; |
54 | aml_append(dev, aml_name_decl("_HID", aml_string("PNP0501"))); | 61 | +} ExtIOICore; |
55 | - aml_append(dev, aml_name_decl("_UID", aml_int(0))); | 62 | + |
56 | + aml_append(dev, aml_name_decl("_UID", aml_int(index))); | 63 | +struct LoongArchExtIOI { |
57 | aml_append(dev, aml_name_decl("_CCA", aml_int(1))); | 64 | + SysBusDevice parent_obj; |
58 | crs = aml_resource_template(); | 65 | + uint32_t num_cpu; |
59 | aml_append(crs, | 66 | + uint32_t features; |
60 | aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, | 67 | + uint32_t status; |
61 | AML_NON_CACHEABLE, AML_READ_WRITE, | 68 | + /* hardware state */ |
62 | - 0, VIRT_UART_BASE, VIRT_UART_BASE + VIRT_UART_SIZE - 1, | 69 | + uint32_t nodetype[EXTIOI_IRQS_NODETYPE_COUNT / 2]; |
63 | + 0, base, base + VIRT_UART_SIZE - 1, | 70 | + uint32_t bounce[EXTIOI_IRQS_GROUP_COUNT]; |
64 | 0, VIRT_UART_SIZE)); | 71 | + uint32_t isr[EXTIOI_IRQS / 32]; |
65 | aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH, | 72 | + uint32_t enable[EXTIOI_IRQS / 32]; |
66 | AML_SHARED, &uart_irq, 1)); | 73 | + uint32_t ipmap[EXTIOI_IRQS_IPMAP_SIZE / 4]; |
67 | @@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_tpm(Aml *scope, LoongArchVirtMachineState *vms) | 74 | + uint32_t coremap[EXTIOI_IRQS / 4]; |
68 | static void | 75 | + uint32_t sw_pending[EXTIOI_IRQS / 32]; |
69 | build_dsdt(GArray *table_data, BIOSLinker *linker, MachineState *machine) | 76 | + uint8_t sw_ipmap[EXTIOI_IRQS_IPMAP_SIZE]; |
70 | { | 77 | + uint8_t sw_coremap[EXTIOI_IRQS]; |
71 | + int i; | 78 | + qemu_irq irq[EXTIOI_IRQS]; |
72 | Aml *dsdt, *scope, *pkg; | 79 | + ExtIOICore *cpu; |
73 | LoongArchVirtMachineState *lvms = LOONGARCH_VIRT_MACHINE(machine); | 80 | + MemoryRegion extioi_system_mem; |
74 | AcpiTable table = { .sig = "DSDT", .rev = 1, .oem_id = lvms->oem_id, | 81 | + MemoryRegion virt_extend; |
75 | @@ -XXX,XX +XXX,XX @@ build_dsdt(GArray *table_data, BIOSLinker *linker, MachineState *machine) | 82 | +}; |
76 | 83 | #endif /* LOONGARCH_EXTIOI_H */ | |
77 | acpi_table_begin(&table, table_data); | ||
78 | dsdt = init_aml_allocator(); | ||
79 | - build_uart_device_aml(dsdt); | ||
80 | + for (i = 0; i < VIRT_UART_COUNT; i++) | ||
81 | + build_uart_device_aml(dsdt, i); | ||
82 | build_pci_device_aml(dsdt, lvms); | ||
83 | build_la_ged_aml(dsdt, machine); | ||
84 | build_flash_aml(dsdt, lvms); | ||
85 | diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c | ||
86 | index XXXXXXX..XXXXXXX 100644 | ||
87 | --- a/hw/loongarch/virt.c | ||
88 | +++ b/hw/loongarch/virt.c | ||
89 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_rtc_node(LoongArchVirtMachineState *lvms, | ||
90 | } | ||
91 | |||
92 | static void fdt_add_uart_node(LoongArchVirtMachineState *lvms, | ||
93 | - uint32_t *pch_pic_phandle) | ||
94 | + uint32_t *pch_pic_phandle, hwaddr base, | ||
95 | + int irq, bool chosen) | ||
96 | { | ||
97 | char *nodename; | ||
98 | - hwaddr base = VIRT_UART_BASE; | ||
99 | hwaddr size = VIRT_UART_SIZE; | ||
100 | MachineState *ms = MACHINE(lvms); | ||
101 | |||
102 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_uart_node(LoongArchVirtMachineState *lvms, | ||
103 | qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", "ns16550a"); | ||
104 | qemu_fdt_setprop_cells(ms->fdt, nodename, "reg", 0x0, base, 0x0, size); | ||
105 | qemu_fdt_setprop_cell(ms->fdt, nodename, "clock-frequency", 100000000); | ||
106 | - qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", nodename); | ||
107 | - qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts", | ||
108 | - VIRT_UART_IRQ - VIRT_GSI_BASE, 0x4); | ||
109 | + if (chosen) | ||
110 | + qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", nodename); | ||
111 | + qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts", irq, 0x4); | ||
112 | qemu_fdt_setprop_cell(ms->fdt, nodename, "interrupt-parent", | ||
113 | *pch_pic_phandle); | ||
114 | g_free(nodename); | ||
115 | @@ -XXX,XX +XXX,XX @@ static void virt_devices_init(DeviceState *pch_pic, | ||
116 | /* Add pcie node */ | ||
117 | fdt_add_pcie_node(lvms, pch_pic_phandle, pch_msi_phandle); | ||
118 | |||
119 | - serial_mm_init(get_system_memory(), VIRT_UART_BASE, 0, | ||
120 | - qdev_get_gpio_in(pch_pic, | ||
121 | - VIRT_UART_IRQ - VIRT_GSI_BASE), | ||
122 | - 115200, serial_hd(0), DEVICE_LITTLE_ENDIAN); | ||
123 | - fdt_add_uart_node(lvms, pch_pic_phandle); | ||
124 | + /* | ||
125 | + * Create uart fdt node in reverse order so that they appear | ||
126 | + * in the finished device tree lowest address first | ||
127 | + */ | ||
128 | + for (i = VIRT_UART_COUNT; i --> 0;) { | ||
129 | + hwaddr base = VIRT_UART_BASE + i * VIRT_UART_SIZE; | ||
130 | + int irq = VIRT_UART_IRQ + i - VIRT_GSI_BASE; | ||
131 | + serial_mm_init(get_system_memory(), base, 0, | ||
132 | + qdev_get_gpio_in(pch_pic, irq), | ||
133 | + 115200, serial_hd(i), DEVICE_LITTLE_ENDIAN); | ||
134 | + fdt_add_uart_node(lvms, pch_pic_phandle, base, irq, i == 0); | ||
135 | + } | ||
136 | |||
137 | /* Network init */ | ||
138 | pci_init_nic_devices(pci_bus, mc->default_nic); | ||
139 | diff --git a/include/hw/pci-host/ls7a.h b/include/hw/pci-host/ls7a.h | ||
140 | index XXXXXXX..XXXXXXX 100644 | ||
141 | --- a/include/hw/pci-host/ls7a.h | ||
142 | +++ b/include/hw/pci-host/ls7a.h | ||
143 | @@ -XXX,XX +XXX,XX @@ | ||
144 | #define VIRT_PCH_PIC_IRQ_NUM 32 | ||
145 | #define VIRT_GSI_BASE 64 | ||
146 | #define VIRT_DEVICE_IRQS 16 | ||
147 | +#define VIRT_UART_COUNT 4 | ||
148 | #define VIRT_UART_IRQ (VIRT_GSI_BASE + 2) | ||
149 | #define VIRT_UART_BASE 0x1fe001e0 | ||
150 | -#define VIRT_UART_SIZE 0X100 | ||
151 | -#define VIRT_RTC_IRQ (VIRT_GSI_BASE + 3) | ||
152 | +#define VIRT_UART_SIZE 0x100 | ||
153 | +#define VIRT_RTC_IRQ (VIRT_GSI_BASE + 6) | ||
154 | #define VIRT_MISC_REG_BASE (VIRT_PCH_REG_BASE + 0x00080000) | ||
155 | #define VIRT_RTC_REG_BASE (VIRT_MISC_REG_BASE + 0x00050100) | ||
156 | #define VIRT_RTC_LEN 0x100 | ||
157 | -#define VIRT_SCI_IRQ (VIRT_GSI_BASE + 4) | ||
158 | +#define VIRT_SCI_IRQ (VIRT_GSI_BASE + 7) | ||
159 | |||
160 | #define VIRT_PLATFORM_BUS_BASEADDRESS 0x16000000 | ||
161 | #define VIRT_PLATFORM_BUS_SIZE 0x2000000 | ||
162 | #define VIRT_PLATFORM_BUS_NUM_IRQS 2 | ||
163 | -#define VIRT_PLATFORM_BUS_IRQ (VIRT_GSI_BASE + 5) | ||
164 | +#define VIRT_PLATFORM_BUS_IRQ (VIRT_GSI_BASE + 8) | ||
165 | #endif | ||
166 | -- | 84 | -- |
167 | 2.34.1 | 85 | 2.43.5 | diff view generated by jsdifflib |
1 | From: Bibo Mao <maobibo@loongson.cn> | 1 | Rename structure LoongArchExtIOI with LoongArchExtIOICommonState, |
---|---|---|---|
2 | 2 | since it is defined in file loongarch_extioi_common.h | |
3 | With edk2-stable202408 LoongArch UEFI bios, CSR PGD register is set only | ||
4 | if its value is equal to zero for boot cpu, it causes reboot issue. Since | ||
5 | CSR PGD register is changed with linux kernel, UEFI BIOS cannot use it. | ||
6 | |||
7 | Add workaround to clear CSR registers relative with TLB in function | ||
8 | loongarch_cpu_reset_hold(), so that VM can reboot with edk2-stable202408 | ||
9 | UEFI bios. | ||
10 | 3 | ||
11 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | 4 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> |
12 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 5 | Reviewed-by: Song Gao <gaosong@loongson.cn> |
13 | Message-Id: <20240827035807.3326293-1-maobibo@loongson.cn> | ||
14 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
15 | --- | 6 | --- |
16 | target/loongarch/cpu.c | 14 ++++++++++++++ | 7 | include/hw/intc/loongarch_extioi.h | 1 + |
17 | 1 file changed, 14 insertions(+) | 8 | include/hw/intc/loongarch_extioi_common.h | 2 +- |
9 | 2 files changed, 2 insertions(+), 1 deletion(-) | ||
18 | 10 | ||
19 | diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c | 11 | diff --git a/include/hw/intc/loongarch_extioi.h b/include/hw/intc/loongarch_extioi.h |
20 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/loongarch/cpu.c | 13 | --- a/include/hw/intc/loongarch_extioi.h |
22 | +++ b/target/loongarch/cpu.c | 14 | +++ b/include/hw/intc/loongarch_extioi.h |
23 | @@ -XXX,XX +XXX,XX @@ static void loongarch_cpu_reset_hold(Object *obj, ResetType type) | 15 | @@ -XXX,XX +XXX,XX @@ |
24 | env->CSR_TLBRERA = FIELD_DP64(env->CSR_TLBRERA, CSR_TLBRERA, ISTLBR, 0); | 16 | |
25 | env->CSR_MERRCTL = FIELD_DP64(env->CSR_MERRCTL, CSR_MERRCTL, ISMERR, 0); | 17 | #include "hw/intc/loongarch_extioi_common.h" |
26 | env->CSR_TID = cs->cpu_index; | 18 | |
27 | + /* | 19 | +#define LoongArchExtIOI LoongArchExtIOICommonState |
28 | + * Workaround for edk2-stable202408, CSR PGD register is set only if | 20 | #define TYPE_LOONGARCH_EXTIOI "loongarch.extioi" |
29 | + * its value is equal to zero for boot cpu, it causes reboot issue. | 21 | OBJECT_DECLARE_SIMPLE_TYPE(LoongArchExtIOI, LOONGARCH_EXTIOI) |
30 | + * | 22 | #endif /* LOONGARCH_EXTIOI_H */ |
31 | + * Here clear CSR registers relative with TLB. | 23 | diff --git a/include/hw/intc/loongarch_extioi_common.h b/include/hw/intc/loongarch_extioi_common.h |
32 | + */ | 24 | index XXXXXXX..XXXXXXX 100644 |
33 | + env->CSR_PGDH = 0; | 25 | --- a/include/hw/intc/loongarch_extioi_common.h |
34 | + env->CSR_PGDL = 0; | 26 | +++ b/include/hw/intc/loongarch_extioi_common.h |
35 | + env->CSR_PWCL = 0; | 27 | @@ -XXX,XX +XXX,XX @@ typedef struct ExtIOICore { |
36 | + env->CSR_PWCH = 0; | 28 | qemu_irq parent_irq[LS3A_INTC_IP]; |
37 | + env->CSR_STLBPS = 0; | 29 | } ExtIOICore; |
38 | + env->CSR_EENTRY = 0; | 30 | |
39 | + env->CSR_TLBRENTRY = 0; | 31 | -struct LoongArchExtIOI { |
40 | + env->CSR_MERRENTRY = 0; | 32 | +struct LoongArchExtIOICommonState { |
41 | 33 | SysBusDevice parent_obj; | |
42 | for (n = 0; n < 4; n++) { | 34 | uint32_t num_cpu; |
43 | env->CSR_DMW[n] = FIELD_DP64(env->CSR_DMW[n], CSR_DMW, PLV0, 0); | 35 | uint32_t features; |
44 | -- | 36 | -- |
45 | 2.34.1 | 37 | 2.43.5 | diff view generated by jsdifflib |
1 | From: Bibo Mao <maobibo@loongson.cn> | 1 | With some structure such as vmstate and property, rename LoongArchExtIOI |
---|---|---|---|
2 | 2 | with LoongArchExtIOICommonState, these common structure will be moved | |
3 | Serial port console redirection table can be used for default serial | 3 | to common file. |
4 | port selection, like chosen stdout-path selection with FDT method. | ||
5 | |||
6 | With acpi SPCR table added, early debug console can be parsed from | ||
7 | SPCR table with simple kernel parameter earlycon rather than | ||
8 | earlycon=uart,mmio,0x1fe001e0 | ||
9 | 4 | ||
10 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | 5 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> |
11 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 6 | Reviewed-by: Song Gao <gaosong@loongson.cn> |
12 | Message-Id: <20240907073037.243353-1-maobibo@loongson.cn> | ||
13 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
14 | --- | 7 | --- |
15 | hw/loongarch/acpi-build.c | 40 +++++++++++++++++++++++++++++++++++++++ | 8 | hw/intc/loongarch_extioi.c | 41 +++++++++++++++++++++++--------------- |
16 | 1 file changed, 40 insertions(+) | 9 | 1 file changed, 25 insertions(+), 16 deletions(-) |
17 | 10 | ||
18 | diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c | 11 | diff --git a/hw/intc/loongarch_extioi.c b/hw/intc/loongarch_extioi.c |
19 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/loongarch/acpi-build.c | 13 | --- a/hw/intc/loongarch_extioi.c |
21 | +++ b/hw/loongarch/acpi-build.c | 14 | +++ b/hw/intc/loongarch_extioi.c |
22 | @@ -XXX,XX +XXX,XX @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) | 15 | @@ -XXX,XX +XXX,XX @@ static int vmstate_extioi_post_load(void *opaque, int version_id) |
23 | acpi_table_end(linker, &table); | 16 | return 0; |
24 | } | 17 | } |
25 | 18 | ||
26 | +/* | 19 | +static int loongarch_extioi_common_post_load(void *opaque, int version_id) |
27 | + * Serial Port Console Redirection Table (SPCR) | ||
28 | + * https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table | ||
29 | + */ | ||
30 | +static void | ||
31 | +spcr_setup(GArray *table_data, BIOSLinker *linker, MachineState *machine) | ||
32 | +{ | 20 | +{ |
33 | + LoongArchVirtMachineState *lvms; | 21 | + return vmstate_extioi_post_load(opaque, version_id); |
34 | + AcpiSpcrData serial = { | ||
35 | + .interface_type = 0, /* 16550 compatible */ | ||
36 | + .base_addr.id = AML_AS_SYSTEM_MEMORY, | ||
37 | + .base_addr.width = 32, | ||
38 | + .base_addr.offset = 0, | ||
39 | + .base_addr.size = 1, | ||
40 | + .base_addr.addr = VIRT_UART_BASE, | ||
41 | + .interrupt_type = 0, /* Interrupt not supported */ | ||
42 | + .pc_interrupt = 0, | ||
43 | + .interrupt = VIRT_UART_IRQ, | ||
44 | + .baud_rate = 7, /* 115200 */ | ||
45 | + .parity = 0, | ||
46 | + .stop_bits = 1, | ||
47 | + .flow_control = 0, | ||
48 | + .terminal_type = 3, /* ANSI */ | ||
49 | + .language = 0, /* Language */ | ||
50 | + .pci_device_id = 0xffff, /* not a PCI device*/ | ||
51 | + .pci_vendor_id = 0xffff, /* not a PCI device*/ | ||
52 | + .pci_bus = 0, | ||
53 | + .pci_device = 0, | ||
54 | + .pci_function = 0, | ||
55 | + .pci_flags = 0, | ||
56 | + .pci_segment = 0, | ||
57 | + }; | ||
58 | + | ||
59 | + lvms = LOONGARCH_VIRT_MACHINE(machine); | ||
60 | + build_spcr(table_data, linker, &serial, 2, lvms->oem_id, | ||
61 | + lvms->oem_table_id); | ||
62 | +} | 22 | +} |
63 | + | 23 | + |
64 | typedef | 24 | static const VMStateDescription vmstate_extioi_core = { |
65 | struct AcpiBuildState { | 25 | .name = "extioi-core", |
66 | /* Copy of table in RAM (for patching). */ | 26 | .version_id = 1, |
67 | @@ -XXX,XX +XXX,XX @@ static void acpi_build(AcpiBuildTables *tables, MachineState *machine) | 27 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_extioi_core = { |
68 | 28 | }; | |
69 | acpi_add_table(table_offsets, tables_blob); | 29 | |
70 | build_srat(tables_blob, tables->linker, machine); | 30 | static const VMStateDescription vmstate_loongarch_extioi = { |
71 | + acpi_add_table(table_offsets, tables_blob); | 31 | - .name = TYPE_LOONGARCH_EXTIOI, |
72 | + spcr_setup(tables_blob, tables->linker, machine); | 32 | + .name = "loongarch.extioi", |
73 | 33 | .version_id = 3, | |
74 | if (machine->numa_state->num_nodes) { | 34 | .minimum_version_id = 3, |
75 | if (machine->numa_state->have_numa_distance) { | 35 | - .post_load = vmstate_extioi_post_load, |
36 | + .post_load = loongarch_extioi_common_post_load, | ||
37 | .fields = (const VMStateField[]) { | ||
38 | - VMSTATE_UINT32_ARRAY(bounce, LoongArchExtIOI, EXTIOI_IRQS_GROUP_COUNT), | ||
39 | - VMSTATE_UINT32_ARRAY(nodetype, LoongArchExtIOI, | ||
40 | + VMSTATE_UINT32_ARRAY(bounce, LoongArchExtIOICommonState, | ||
41 | + EXTIOI_IRQS_GROUP_COUNT), | ||
42 | + VMSTATE_UINT32_ARRAY(nodetype, LoongArchExtIOICommonState, | ||
43 | EXTIOI_IRQS_NODETYPE_COUNT / 2), | ||
44 | - VMSTATE_UINT32_ARRAY(enable, LoongArchExtIOI, EXTIOI_IRQS / 32), | ||
45 | - VMSTATE_UINT32_ARRAY(isr, LoongArchExtIOI, EXTIOI_IRQS / 32), | ||
46 | - VMSTATE_UINT32_ARRAY(ipmap, LoongArchExtIOI, EXTIOI_IRQS_IPMAP_SIZE / 4), | ||
47 | - VMSTATE_UINT32_ARRAY(coremap, LoongArchExtIOI, EXTIOI_IRQS / 4), | ||
48 | - | ||
49 | - VMSTATE_STRUCT_VARRAY_POINTER_UINT32(cpu, LoongArchExtIOI, num_cpu, | ||
50 | - vmstate_extioi_core, ExtIOICore), | ||
51 | - VMSTATE_UINT32(features, LoongArchExtIOI), | ||
52 | - VMSTATE_UINT32(status, LoongArchExtIOI), | ||
53 | + VMSTATE_UINT32_ARRAY(enable, LoongArchExtIOICommonState, | ||
54 | + EXTIOI_IRQS / 32), | ||
55 | + VMSTATE_UINT32_ARRAY(isr, LoongArchExtIOICommonState, | ||
56 | + EXTIOI_IRQS / 32), | ||
57 | + VMSTATE_UINT32_ARRAY(ipmap, LoongArchExtIOICommonState, | ||
58 | + EXTIOI_IRQS_IPMAP_SIZE / 4), | ||
59 | + VMSTATE_UINT32_ARRAY(coremap, LoongArchExtIOICommonState, | ||
60 | + EXTIOI_IRQS / 4), | ||
61 | + VMSTATE_STRUCT_VARRAY_POINTER_UINT32(cpu, LoongArchExtIOICommonState, | ||
62 | + num_cpu, vmstate_extioi_core, ExtIOICore), | ||
63 | + VMSTATE_UINT32(features, LoongArchExtIOICommonState), | ||
64 | + VMSTATE_UINT32(status, LoongArchExtIOICommonState), | ||
65 | VMSTATE_END_OF_LIST() | ||
66 | } | ||
67 | }; | ||
68 | |||
69 | static Property extioi_properties[] = { | ||
70 | - DEFINE_PROP_UINT32("num-cpu", LoongArchExtIOI, num_cpu, 1), | ||
71 | - DEFINE_PROP_BIT("has-virtualization-extension", LoongArchExtIOI, features, | ||
72 | - EXTIOI_HAS_VIRT_EXTENSION, 0), | ||
73 | + DEFINE_PROP_UINT32("num-cpu", LoongArchExtIOICommonState, num_cpu, 1), | ||
74 | + DEFINE_PROP_BIT("has-virtualization-extension", LoongArchExtIOICommonState, | ||
75 | + features, EXTIOI_HAS_VIRT_EXTENSION, 0), | ||
76 | DEFINE_PROP_END_OF_LIST(), | ||
77 | }; | ||
78 | |||
76 | -- | 79 | -- |
77 | 2.34.1 | 80 | 2.43.5 | diff view generated by jsdifflib |