1 | The following changes since commit a5ba0a7e4e150d1350a041f0d0ef9ca6c8d7c307: | 1 | The following changes since commit ece5f8374d0416a339f0c0a9399faa2c42d4ad6f: |
---|---|---|---|
2 | 2 | ||
3 | Merge tag 'pull-aspeed-20241211' of https://github.com/legoater/qemu into staging (2024-12-11 15:16:47 +0000) | 3 | Merge tag 'linux-user-for-7.2-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging (2022-11-03 10:55:05 -0400) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | https://gitlab.com/bibo-mao/qemu.git pull-loongarch-20241213 | 7 | https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20221105 |
8 | 8 | ||
9 | for you to fetch changes up to 78aa256571aa06f32001bd80635a1858187c609b: | 9 | for you to fetch changes up to 6a284614d485f36af6467ce0925df0042aca7a1f: |
10 | 10 | ||
11 | hw/intc/loongarch_pch: Code cleanup about loongarch_pch_pic (2024-12-13 14:39:39 +0800) | 11 | target/loongarch: Fix raise_mmu_exception() set wrong exception_index (2022-11-05 10:52:19 +0800) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | pull-loongarch-20241213 | 14 | pull-loongarch-20221105 |
15 | |||
16 | V3: | ||
17 | - According to Richard's latest comments, drop patch 8, 9. | ||
18 | |||
19 | v2: | ||
20 | - fix win32/win64 complie error; | ||
21 | - Add Rui Wang' patches. | ||
15 | 22 | ||
16 | ---------------------------------------------------------------- | 23 | ---------------------------------------------------------------- |
17 | Bibo Mao (8): | 24 | Song Gao (2): |
18 | include: Add loongarch_pic_common header file | 25 | target/loongarch: Add exception subcode |
19 | include: Move struct LoongArchPCHPIC to loongarch_pic_common header file | 26 | target/loongarch: Fix raise_mmu_exception() set wrong exception_index |
20 | hw/intc/loongarch_pch: Merge instance_init() into realize() | ||
21 | hw/intc/loongarch_pch: Rename LoongArchPCHPIC with LoongArchPICCommonState | ||
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 | ||
26 | 27 | ||
27 | hw/intc/loongarch_pch_pic.c | 106 +++++++++++---------------------- | 28 | Xiaojuan Yang (5): |
28 | hw/intc/loongarch_pic_common.c | 97 ++++++++++++++++++++++++++++++ | 29 | hw/intc: Convert the memops to with_attrs in LoongArch extioi |
29 | hw/intc/meson.build | 2 +- | 30 | hw/intc: Fix LoongArch extioi coreisr accessing |
30 | hw/loongarch/virt.c | 2 +- | 31 | hw/loongarch: Load FDT table into dram memory space |
31 | include/hw/intc/loongarch_pch_pic.h | 70 +++++----------------- | 32 | hw/loongarch: Improve fdt for LoongArch virt machine |
32 | include/hw/intc/loongarch_pic_common.h | 82 +++++++++++++++++++++++++ | 33 | hw/loongarch: Add TPM device for LoongArch virt machine |
33 | 6 files changed, 230 insertions(+), 129 deletions(-) | 34 | |
34 | create mode 100644 hw/intc/loongarch_pic_common.c | 35 | hw/intc/loongarch_extioi.c | 41 ++++++++++++++++------------- |
35 | create mode 100644 include/hw/intc/loongarch_pic_common.h | 36 | hw/intc/trace-events | 3 +-- |
37 | hw/loongarch/acpi-build.c | 51 +++++++++++++++++++++++++++++++++++- | ||
38 | hw/loongarch/virt.c | 53 ++++++++++++++++++++++++++++++++----- | ||
39 | include/hw/loongarch/virt.h | 3 --- | ||
40 | include/hw/pci-host/ls7a.h | 1 + | ||
41 | target/loongarch/cpu.c | 8 ++++-- | ||
42 | target/loongarch/cpu.h | 58 ++++++++++++++++++++++------------------- | ||
43 | target/loongarch/iocsr_helper.c | 19 ++++++++------ | ||
44 | target/loongarch/tlb_helper.c | 5 ++-- | ||
45 | 10 files changed, 172 insertions(+), 70 deletions(-) | diff view generated by jsdifflib |
Deleted 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. | ||
4 | 1 | ||
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 |
Deleted 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. | ||
4 | 1 | ||
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 |
Deleted 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. | ||
3 | 1 | ||
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 | With pic vmstate, rename structure name vmstate_loongarch_pch_pic with | 1 | From: Xiaojuan Yang <yangxiaojuan@loongson.cn> |
---|---|---|---|
2 | vmstate_loongarch_pic_common, and with pic property rename | ||
3 | loongarch_pch_pic_properties with loongarch_pic_common_properties. | ||
4 | 2 | ||
5 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | 3 | Converting the MemoryRegionOps read/write handlers to |
6 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 4 | with_attrs in LoongArch extioi emulation. |
5 | |||
6 | Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-Id: <20221021015307.2570844-2-yangxiaojuan@loongson.cn> | ||
10 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
7 | --- | 11 | --- |
8 | hw/intc/loongarch_pch_pic.c | 52 +++++++++++++++++++++++-------------- | 12 | hw/intc/loongarch_extioi.c | 31 +++++++++++++++++-------------- |
9 | 1 file changed, 32 insertions(+), 20 deletions(-) | 13 | hw/intc/trace-events | 3 +-- |
14 | 2 files changed, 18 insertions(+), 16 deletions(-) | ||
10 | 15 | ||
11 | diff --git a/hw/intc/loongarch_pch_pic.c b/hw/intc/loongarch_pch_pic.c | 16 | diff --git a/hw/intc/loongarch_extioi.c b/hw/intc/loongarch_extioi.c |
12 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/intc/loongarch_pch_pic.c | 18 | --- a/hw/intc/loongarch_extioi.c |
14 | +++ b/hw/intc/loongarch_pch_pic.c | 19 | +++ b/hw/intc/loongarch_extioi.c |
15 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_reset(DeviceState *d) | 20 | @@ -XXX,XX +XXX,XX @@ static void extioi_setirq(void *opaque, int irq, int level) |
16 | s->int_polarity = 0x0; | 21 | extioi_update_irq(s, irq, level); |
17 | } | 22 | } |
18 | 23 | ||
19 | +static void loongarch_pic_common_realize(DeviceState *dev, Error **errp) | 24 | -static uint64_t extioi_readw(void *opaque, hwaddr addr, unsigned size) |
20 | +{ | 25 | +static MemTxResult extioi_readw(void *opaque, hwaddr addr, uint64_t *data, |
21 | + LoongArchPICCommonState *s = LOONGARCH_PCH_PIC(dev); | 26 | + unsigned size, MemTxAttrs attrs) |
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 | { | 27 | { |
31 | LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(dev); | 28 | LoongArchExtIOI *s = LOONGARCH_EXTIOI(opaque); |
32 | SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | 29 | unsigned long offset = addr & 0xffff; |
33 | + Error *local_err = NULL; | 30 | - uint32_t index, cpu, ret = 0; |
34 | 31 | + uint32_t index, cpu; | |
35 | - if (!s->irq_num || s->irq_num > VIRT_PCH_PIC_IRQ_NUM) { | 32 | |
36 | - error_setg(errp, "Invalid 'pic_irq_num'"); | 33 | switch (offset) { |
37 | + loongarch_pic_common_realize(dev, &local_err); | 34 | case EXTIOI_NODETYPE_START ... EXTIOI_NODETYPE_END - 1: |
38 | + if (local_err) { | 35 | index = (offset - EXTIOI_NODETYPE_START) >> 2; |
39 | + error_propagate(errp, local_err); | 36 | - ret = s->nodetype[index]; |
40 | return; | 37 | + *data = s->nodetype[index]; |
38 | break; | ||
39 | case EXTIOI_IPMAP_START ... EXTIOI_IPMAP_END - 1: | ||
40 | index = (offset - EXTIOI_IPMAP_START) >> 2; | ||
41 | - ret = s->ipmap[index]; | ||
42 | + *data = s->ipmap[index]; | ||
43 | break; | ||
44 | case EXTIOI_ENABLE_START ... EXTIOI_ENABLE_END - 1: | ||
45 | index = (offset - EXTIOI_ENABLE_START) >> 2; | ||
46 | - ret = s->enable[index]; | ||
47 | + *data = s->enable[index]; | ||
48 | break; | ||
49 | case EXTIOI_BOUNCE_START ... EXTIOI_BOUNCE_END - 1: | ||
50 | index = (offset - EXTIOI_BOUNCE_START) >> 2; | ||
51 | - ret = s->bounce[index]; | ||
52 | + *data = s->bounce[index]; | ||
53 | break; | ||
54 | case EXTIOI_COREISR_START ... EXTIOI_COREISR_END - 1: | ||
55 | index = ((offset - EXTIOI_COREISR_START) & 0x1f) >> 2; | ||
56 | cpu = ((offset - EXTIOI_COREISR_START) >> 8) & 0x3; | ||
57 | - ret = s->coreisr[cpu][index]; | ||
58 | + *data = s->coreisr[cpu][index]; | ||
59 | break; | ||
60 | case EXTIOI_COREMAP_START ... EXTIOI_COREMAP_END - 1: | ||
61 | index = (offset - EXTIOI_COREMAP_START) >> 2; | ||
62 | - ret = s->coremap[index]; | ||
63 | + *data = s->coremap[index]; | ||
64 | break; | ||
65 | default: | ||
66 | break; | ||
41 | } | 67 | } |
42 | 68 | ||
43 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_realize(DeviceState *dev, Error **errp) | 69 | - trace_loongarch_extioi_readw(addr, ret); |
44 | 70 | - return ret; | |
71 | + trace_loongarch_extioi_readw(addr, *data); | ||
72 | + return MEMTX_OK; | ||
45 | } | 73 | } |
46 | 74 | ||
47 | -static Property loongarch_pch_pic_properties[] = { | 75 | static inline void extioi_enable_irq(LoongArchExtIOI *s, int index,\ |
48 | - DEFINE_PROP_UINT32("pch_pic_irq_num", LoongArchPCHPIC, irq_num, 0), | 76 | @@ -XXX,XX +XXX,XX @@ static inline void extioi_enable_irq(LoongArchExtIOI *s, int index,\ |
49 | +static Property loongarch_pic_common_properties[] = { | ||
50 | + DEFINE_PROP_UINT32("pch_pic_irq_num", LoongArchPICCommonState, irq_num, 0), | ||
51 | DEFINE_PROP_END_OF_LIST(), | ||
52 | }; | ||
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 | } | 77 | } |
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); | ||
96 | } | 78 | } |
97 | 79 | ||
98 | static const TypeInfo loongarch_pch_pic_info = { | 80 | -static void extioi_writew(void *opaque, hwaddr addr, |
81 | - uint64_t val, unsigned size) | ||
82 | +static MemTxResult extioi_writew(void *opaque, hwaddr addr, | ||
83 | + uint64_t val, unsigned size, | ||
84 | + MemTxAttrs attrs) | ||
85 | { | ||
86 | LoongArchExtIOI *s = LOONGARCH_EXTIOI(opaque); | ||
87 | int i, cpu, index, old_data, irq; | ||
88 | @@ -XXX,XX +XXX,XX @@ static void extioi_writew(void *opaque, hwaddr addr, | ||
89 | default: | ||
90 | break; | ||
91 | } | ||
92 | + return MEMTX_OK; | ||
93 | } | ||
94 | |||
95 | static const MemoryRegionOps extioi_ops = { | ||
96 | - .read = extioi_readw, | ||
97 | - .write = extioi_writew, | ||
98 | + .read_with_attrs = extioi_readw, | ||
99 | + .write_with_attrs = extioi_writew, | ||
100 | .impl.min_access_size = 4, | ||
101 | .impl.max_access_size = 4, | ||
102 | .valid.min_access_size = 4, | ||
103 | diff --git a/hw/intc/trace-events b/hw/intc/trace-events | ||
104 | index XXXXXXX..XXXXXXX 100644 | ||
105 | --- a/hw/intc/trace-events | ||
106 | +++ b/hw/intc/trace-events | ||
107 | @@ -XXX,XX +XXX,XX @@ loongarch_msi_set_irq(int irq_num) "set msi irq %d" | ||
108 | |||
109 | # loongarch_extioi.c | ||
110 | loongarch_extioi_setirq(int irq, int level) "set extirq irq %d level %d" | ||
111 | -loongarch_extioi_readw(uint64_t addr, uint32_t val) "addr: 0x%"PRIx64 "val: 0x%x" | ||
112 | +loongarch_extioi_readw(uint64_t addr, uint64_t val) "addr: 0x%"PRIx64 "val: 0x%" PRIx64 | ||
113 | loongarch_extioi_writew(uint64_t addr, uint64_t val) "addr: 0x%"PRIx64 "val: 0x%" PRIx64 | ||
114 | - | ||
99 | -- | 115 | -- |
100 | 2.43.5 | 116 | 2.31.1 |
117 | |||
118 | diff view generated by jsdifflib |
Deleted 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. | ||
5 | 1 | ||
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 |
1 | With some structure such as vmstate and property, rename LoongArchExtIOI | 1 | From: Xiaojuan Yang <yangxiaojuan@loongson.cn> |
---|---|---|---|
2 | with LoongArchExtIOICommonState, these common structure will be moved | ||
3 | to common file. | ||
4 | 2 | ||
5 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | 3 | 1. When cpu read or write extioi COREISR reg, it should access |
6 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 4 | the reg belonged to itself, so the cpu index of 's->coreisr' |
5 | is current cpu number. Using MemTxAttrs' requester_id to get | ||
6 | the cpu index. | ||
7 | 2. it need not to mask 0x1f when calculate the coreisr array index. | ||
8 | |||
9 | Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-Id: <20221021015307.2570844-3-yangxiaojuan@loongson.cn> | ||
12 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
7 | --- | 13 | --- |
8 | hw/intc/loongarch_extioi.c | 41 +++++++++++++++++++++++--------------- | 14 | hw/intc/loongarch_extioi.c | 10 ++++++---- |
9 | 1 file changed, 25 insertions(+), 16 deletions(-) | 15 | target/loongarch/iocsr_helper.c | 19 +++++++++++-------- |
16 | 2 files changed, 17 insertions(+), 12 deletions(-) | ||
10 | 17 | ||
11 | diff --git a/hw/intc/loongarch_extioi.c b/hw/intc/loongarch_extioi.c | 18 | diff --git a/hw/intc/loongarch_extioi.c b/hw/intc/loongarch_extioi.c |
12 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/intc/loongarch_extioi.c | 20 | --- a/hw/intc/loongarch_extioi.c |
14 | +++ b/hw/intc/loongarch_extioi.c | 21 | +++ b/hw/intc/loongarch_extioi.c |
15 | @@ -XXX,XX +XXX,XX @@ static int vmstate_extioi_post_load(void *opaque, int version_id) | 22 | @@ -XXX,XX +XXX,XX @@ static MemTxResult extioi_readw(void *opaque, hwaddr addr, uint64_t *data, |
16 | return 0; | 23 | *data = s->bounce[index]; |
24 | break; | ||
25 | case EXTIOI_COREISR_START ... EXTIOI_COREISR_END - 1: | ||
26 | - index = ((offset - EXTIOI_COREISR_START) & 0x1f) >> 2; | ||
27 | - cpu = ((offset - EXTIOI_COREISR_START) >> 8) & 0x3; | ||
28 | + index = (offset - EXTIOI_COREISR_START) >> 2; | ||
29 | + /* using attrs to get current cpu index */ | ||
30 | + cpu = attrs.requester_id; | ||
31 | *data = s->coreisr[cpu][index]; | ||
32 | break; | ||
33 | case EXTIOI_COREMAP_START ... EXTIOI_COREMAP_END - 1: | ||
34 | @@ -XXX,XX +XXX,XX @@ static MemTxResult extioi_writew(void *opaque, hwaddr addr, | ||
35 | s->bounce[index] = val; | ||
36 | break; | ||
37 | case EXTIOI_COREISR_START ... EXTIOI_COREISR_END - 1: | ||
38 | - index = ((offset - EXTIOI_COREISR_START) & 0x1f) >> 2; | ||
39 | - cpu = ((offset - EXTIOI_COREISR_START) >> 8) & 0x3; | ||
40 | + index = (offset - EXTIOI_COREISR_START) >> 2; | ||
41 | + /* using attrs to get current cpu index */ | ||
42 | + cpu = attrs.requester_id; | ||
43 | old_data = s->coreisr[cpu][index]; | ||
44 | s->coreisr[cpu][index] = old_data & ~val; | ||
45 | /* write 1 to clear interrrupt */ | ||
46 | diff --git a/target/loongarch/iocsr_helper.c b/target/loongarch/iocsr_helper.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/target/loongarch/iocsr_helper.c | ||
49 | +++ b/target/loongarch/iocsr_helper.c | ||
50 | @@ -XXX,XX +XXX,XX @@ | ||
51 | #include "exec/cpu_ldst.h" | ||
52 | #include "tcg/tcg-ldst.h" | ||
53 | |||
54 | +#define GET_MEMTXATTRS(cas) \ | ||
55 | + ((MemTxAttrs){.requester_id = env_cpu(cas)->cpu_index}) | ||
56 | + | ||
57 | uint64_t helper_iocsrrd_b(CPULoongArchState *env, target_ulong r_addr) | ||
58 | { | ||
59 | return address_space_ldub(&env->address_space_iocsr, r_addr, | ||
60 | - MEMTXATTRS_UNSPECIFIED, NULL); | ||
61 | + GET_MEMTXATTRS(env), NULL); | ||
17 | } | 62 | } |
18 | 63 | ||
19 | +static int loongarch_extioi_common_post_load(void *opaque, int version_id) | 64 | uint64_t helper_iocsrrd_h(CPULoongArchState *env, target_ulong r_addr) |
20 | +{ | 65 | { |
21 | + return vmstate_extioi_post_load(opaque, version_id); | 66 | return address_space_lduw(&env->address_space_iocsr, r_addr, |
22 | +} | 67 | - MEMTXATTRS_UNSPECIFIED, NULL); |
23 | + | 68 | + GET_MEMTXATTRS(env), NULL); |
24 | static const VMStateDescription vmstate_extioi_core = { | 69 | } |
25 | .name = "extioi-core", | 70 | |
26 | .version_id = 1, | 71 | uint64_t helper_iocsrrd_w(CPULoongArchState *env, target_ulong r_addr) |
27 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_extioi_core = { | 72 | { |
28 | }; | 73 | return address_space_ldl(&env->address_space_iocsr, r_addr, |
29 | 74 | - MEMTXATTRS_UNSPECIFIED, NULL); | |
30 | static const VMStateDescription vmstate_loongarch_extioi = { | 75 | + GET_MEMTXATTRS(env), NULL); |
31 | - .name = TYPE_LOONGARCH_EXTIOI, | 76 | } |
32 | + .name = "loongarch.extioi", | 77 | |
33 | .version_id = 3, | 78 | uint64_t helper_iocsrrd_d(CPULoongArchState *env, target_ulong r_addr) |
34 | .minimum_version_id = 3, | 79 | { |
35 | - .post_load = vmstate_extioi_post_load, | 80 | return address_space_ldq(&env->address_space_iocsr, r_addr, |
36 | + .post_load = loongarch_extioi_common_post_load, | 81 | - MEMTXATTRS_UNSPECIFIED, NULL); |
37 | .fields = (const VMStateField[]) { | 82 | + GET_MEMTXATTRS(env), NULL); |
38 | - VMSTATE_UINT32_ARRAY(bounce, LoongArchExtIOI, EXTIOI_IRQS_GROUP_COUNT), | 83 | } |
39 | - VMSTATE_UINT32_ARRAY(nodetype, LoongArchExtIOI, | 84 | |
40 | + VMSTATE_UINT32_ARRAY(bounce, LoongArchExtIOICommonState, | 85 | void helper_iocsrwr_b(CPULoongArchState *env, target_ulong w_addr, |
41 | + EXTIOI_IRQS_GROUP_COUNT), | 86 | target_ulong val) |
42 | + VMSTATE_UINT32_ARRAY(nodetype, LoongArchExtIOICommonState, | 87 | { |
43 | EXTIOI_IRQS_NODETYPE_COUNT / 2), | 88 | address_space_stb(&env->address_space_iocsr, w_addr, |
44 | - VMSTATE_UINT32_ARRAY(enable, LoongArchExtIOI, EXTIOI_IRQS / 32), | 89 | - val, MEMTXATTRS_UNSPECIFIED, NULL); |
45 | - VMSTATE_UINT32_ARRAY(isr, LoongArchExtIOI, EXTIOI_IRQS / 32), | 90 | + val, GET_MEMTXATTRS(env), NULL); |
46 | - VMSTATE_UINT32_ARRAY(ipmap, LoongArchExtIOI, EXTIOI_IRQS_IPMAP_SIZE / 4), | 91 | } |
47 | - VMSTATE_UINT32_ARRAY(coremap, LoongArchExtIOI, EXTIOI_IRQS / 4), | 92 | |
48 | - | 93 | void helper_iocsrwr_h(CPULoongArchState *env, target_ulong w_addr, |
49 | - VMSTATE_STRUCT_VARRAY_POINTER_UINT32(cpu, LoongArchExtIOI, num_cpu, | 94 | target_ulong val) |
50 | - vmstate_extioi_core, ExtIOICore), | 95 | { |
51 | - VMSTATE_UINT32(features, LoongArchExtIOI), | 96 | address_space_stw(&env->address_space_iocsr, w_addr, |
52 | - VMSTATE_UINT32(status, LoongArchExtIOI), | 97 | - val, MEMTXATTRS_UNSPECIFIED, NULL); |
53 | + VMSTATE_UINT32_ARRAY(enable, LoongArchExtIOICommonState, | 98 | + val, GET_MEMTXATTRS(env), NULL); |
54 | + EXTIOI_IRQS / 32), | 99 | } |
55 | + VMSTATE_UINT32_ARRAY(isr, LoongArchExtIOICommonState, | 100 | |
56 | + EXTIOI_IRQS / 32), | 101 | void helper_iocsrwr_w(CPULoongArchState *env, target_ulong w_addr, |
57 | + VMSTATE_UINT32_ARRAY(ipmap, LoongArchExtIOICommonState, | 102 | target_ulong val) |
58 | + EXTIOI_IRQS_IPMAP_SIZE / 4), | 103 | { |
59 | + VMSTATE_UINT32_ARRAY(coremap, LoongArchExtIOICommonState, | 104 | address_space_stl(&env->address_space_iocsr, w_addr, |
60 | + EXTIOI_IRQS / 4), | 105 | - val, MEMTXATTRS_UNSPECIFIED, NULL); |
61 | + VMSTATE_STRUCT_VARRAY_POINTER_UINT32(cpu, LoongArchExtIOICommonState, | 106 | + val, GET_MEMTXATTRS(env), NULL); |
62 | + num_cpu, vmstate_extioi_core, ExtIOICore), | 107 | } |
63 | + VMSTATE_UINT32(features, LoongArchExtIOICommonState), | 108 | |
64 | + VMSTATE_UINT32(status, LoongArchExtIOICommonState), | 109 | void helper_iocsrwr_d(CPULoongArchState *env, target_ulong w_addr, |
65 | VMSTATE_END_OF_LIST() | 110 | target_ulong val) |
66 | } | 111 | { |
67 | }; | 112 | address_space_stq(&env->address_space_iocsr, w_addr, |
68 | 113 | - val, MEMTXATTRS_UNSPECIFIED, NULL); | |
69 | static Property extioi_properties[] = { | 114 | + val, GET_MEMTXATTRS(env), NULL); |
70 | - DEFINE_PROP_UINT32("num-cpu", LoongArchExtIOI, num_cpu, 1), | 115 | } |
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 | |||
79 | -- | 116 | -- |
80 | 2.43.5 | 117 | 2.31.1 | diff view generated by jsdifflib |
1 | Set TYPE_LOONGARCH_PIC inherit from TYPE_LOONGARCH_PIC_COMMON object, | 1 | From: Xiaojuan Yang <yangxiaojuan@loongson.cn> |
---|---|---|---|
2 | it shares vmsate and property of TYPE_LOONGARCH_PIC_COMMON, and has | ||
3 | its own realize() function. | ||
4 | 2 | ||
5 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | 3 | Load FDT table into dram memory space, and the addr is 2 MiB. |
6 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 4 | Since lowmem region starts from 0, FDT base address is located |
5 | at 2 MiB to avoid NULL pointer access. | ||
6 | |||
7 | Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn> | ||
8 | Acked-by: Song Gao <gaosong@loongson.cn> | ||
9 | Message-Id: <20221028014007.2718352-2-yangxiaojuan@loongson.cn> | ||
10 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
7 | --- | 11 | --- |
8 | hw/intc/loongarch_pch_pic.c | 38 ++++++++++++-------------- | 12 | hw/loongarch/virt.c | 18 +++++++++++------- |
9 | hw/intc/loongarch_pic_common.c | 32 +++++++++++++++++++++- | 13 | include/hw/loongarch/virt.h | 3 --- |
10 | hw/intc/meson.build | 2 +- | 14 | 2 files changed, 11 insertions(+), 10 deletions(-) |
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 | ||
15 | diff --git a/hw/intc/loongarch_pch_pic.c b/hw/intc/loongarch_pch_pic.c | 16 | diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c |
16 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/intc/loongarch_pch_pic.c | 18 | --- a/hw/loongarch/virt.c |
18 | +++ b/hw/intc/loongarch_pch_pic.c | 19 | +++ b/hw/loongarch/virt.c |
19 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_reset(DeviceState *d) | 20 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_pcie_node(const LoongArchMachineState *lams) |
20 | s->int_polarity = 0x0; | 21 | 1, FDT_PCI_RANGE_MMIO, 2, base_mmio, |
22 | 2, base_mmio, 2, size_mmio); | ||
23 | g_free(nodename); | ||
24 | - qemu_fdt_dumpdtb(ms->fdt, lams->fdt_size); | ||
21 | } | 25 | } |
22 | 26 | ||
23 | -#include "loongarch_pic_common.c" | 27 | static void fdt_add_irqchip_node(LoongArchMachineState *lams) |
24 | -static void loongarch_pch_pic_realize(DeviceState *dev, Error **errp) | 28 | @@ -XXX,XX +XXX,XX @@ static void loongarch_init(MachineState *machine) |
25 | +static void loongarch_pic_realize(DeviceState *dev, Error **errp) | 29 | MemoryRegion *address_space_mem = get_system_memory(); |
26 | { | 30 | LoongArchMachineState *lams = LOONGARCH_MACHINE(machine); |
27 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(dev); | 31 | int i; |
28 | - SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | 32 | + hwaddr fdt_base; |
29 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(dev); | 33 | |
30 | + LoongarchPICClass *lpc = LOONGARCH_PIC_GET_CLASS(dev); | 34 | if (!cpu_model) { |
31 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | 35 | cpu_model = LOONGARCH_CPU_TYPE_NAME("la464"); |
32 | Error *local_err = NULL; | 36 | @@ -XXX,XX +XXX,XX @@ static void loongarch_init(MachineState *machine) |
33 | 37 | lams->machine_done.notify = virt_machine_done; | |
34 | - loongarch_pic_common_realize(dev, &local_err); | 38 | qemu_add_machine_init_done_notifier(&lams->machine_done); |
35 | + lpc->parent_realize(dev, &local_err); | 39 | fdt_add_pcie_node(lams); |
36 | if (local_err) { | 40 | - |
37 | error_propagate(errp, local_err); | 41 | - /* load fdt */ |
38 | return; | 42 | - MemoryRegion *fdt_rom = g_new(MemoryRegion, 1); |
39 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_realize(DeviceState *dev, Error **errp) | 43 | - memory_region_init_rom(fdt_rom, NULL, "fdt", VIRT_FDT_SIZE, &error_fatal); |
40 | 44 | - memory_region_add_subregion(get_system_memory(), VIRT_FDT_BASE, fdt_rom); | |
45 | - rom_add_blob_fixed("fdt", machine->fdt, lams->fdt_size, VIRT_FDT_BASE); | ||
46 | + /* | ||
47 | + * Since lowmem region starts from 0, FDT base address is located | ||
48 | + * at 2 MiB to avoid NULL pointer access. | ||
49 | + * | ||
50 | + * Put the FDT into the memory map as a ROM image: this will ensure | ||
51 | + * the FDT is copied again upon reset, even if addr points into RAM. | ||
52 | + */ | ||
53 | + fdt_base = 2 * MiB; | ||
54 | + qemu_fdt_dumpdtb(machine->fdt, lams->fdt_size); | ||
55 | + rom_add_blob_fixed("fdt", machine->fdt, lams->fdt_size, fdt_base); | ||
41 | } | 56 | } |
42 | 57 | ||
43 | -static void loongarch_pch_pic_class_init(ObjectClass *klass, void *data) | 58 | bool loongarch_is_acpi_enabled(LoongArchMachineState *lams) |
44 | +static void loongarch_pic_class_init(ObjectClass *klass, void *data) | 59 | diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h |
45 | { | 60 | index XXXXXXX..XXXXXXX 100644 |
46 | DeviceClass *dc = DEVICE_CLASS(klass); | 61 | --- a/include/hw/loongarch/virt.h |
47 | + LoongarchPICClass *lpc = LOONGARCH_PIC_CLASS(klass); | 62 | +++ b/include/hw/loongarch/virt.h |
48 | 63 | @@ -XXX,XX +XXX,XX @@ | |
49 | - dc->realize = loongarch_pch_pic_realize; | 64 | #define VIRT_GED_MEM_ADDR (VIRT_GED_EVT_ADDR + ACPI_GED_EVT_SEL_LEN) |
50 | device_class_set_legacy_reset(dc, loongarch_pch_pic_reset); | 65 | #define VIRT_GED_REG_ADDR (VIRT_GED_MEM_ADDR + MEMORY_HOTPLUG_IO_LEN) |
51 | - dc->vmsd = &vmstate_loongarch_pic_common; | 66 | |
52 | - device_class_set_props(dc, loongarch_pic_common_properties); | 67 | -#define VIRT_FDT_BASE 0x1c400000 |
53 | + device_class_set_parent_realize(dc, loongarch_pic_realize, | 68 | -#define VIRT_FDT_SIZE 0x100000 |
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 | - | 69 | - |
77 | -type_init(loongarch_pch_pic_register_types) | 70 | struct LoongArchMachineState { |
78 | +DEFINE_TYPES(loongarch_pic_types) | 71 | /*< private >*/ |
79 | diff --git a/hw/intc/loongarch_pic_common.c b/hw/intc/loongarch_pic_common.c | 72 | MachineState parent_obj; |
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 | -- | 73 | -- |
198 | 2.43.5 | 74 | 2.31.1 | diff view generated by jsdifflib |
1 | Add vmstate pre_save and post_load interfaces, which can be used | 1 | From: Xiaojuan Yang <yangxiaojuan@loongson.cn> |
---|---|---|---|
2 | by pic kvm driver in future. | ||
3 | 2 | ||
4 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | 3 | Add new items into LoongArch FDT, including rtc and uart info. |
4 | |||
5 | Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn> | ||
5 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 6 | Reviewed-by: Song Gao <gaosong@loongson.cn> |
7 | Message-Id: <20221028014007.2718352-3-yangxiaojuan@loongson.cn> | ||
8 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
6 | --- | 9 | --- |
7 | hw/intc/loongarch_pic_common.c | 26 ++++++++++++++++++++++++++ | 10 | hw/loongarch/virt.c | 31 +++++++++++++++++++++++++++++++ |
8 | include/hw/intc/loongarch_pic_common.h | 2 ++ | 11 | include/hw/pci-host/ls7a.h | 1 + |
9 | 2 files changed, 28 insertions(+) | 12 | 2 files changed, 32 insertions(+) |
10 | 13 | ||
11 | diff --git a/hw/intc/loongarch_pic_common.c b/hw/intc/loongarch_pic_common.c | 14 | diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c |
12 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/intc/loongarch_pic_common.c | 16 | --- a/hw/loongarch/virt.c |
14 | +++ b/hw/intc/loongarch_pic_common.c | 17 | +++ b/hw/loongarch/virt.c |
15 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ |
16 | #include "hw/qdev-properties.h" | 19 | #include "hw/display/ramfb.h" |
17 | #include "migration/vmstate.h" | 20 | #include "hw/mem/pc-dimm.h" |
18 | 21 | ||
19 | +static int loongarch_pic_pre_save(void *opaque) | 22 | +static void fdt_add_rtc_node(LoongArchMachineState *lams) |
20 | +{ | 23 | +{ |
21 | + LoongArchPICCommonState *s = (LoongArchPICCommonState *)opaque; | 24 | + char *nodename; |
22 | + LoongArchPICCommonClass *lpcc = LOONGARCH_PIC_COMMON_GET_CLASS(s); | 25 | + hwaddr base = VIRT_RTC_REG_BASE; |
26 | + hwaddr size = VIRT_RTC_LEN; | ||
27 | + MachineState *ms = MACHINE(lams); | ||
23 | + | 28 | + |
24 | + if (lpcc->pre_save) { | 29 | + nodename = g_strdup_printf("/rtc@%" PRIx64, base); |
25 | + return lpcc->pre_save(s); | 30 | + qemu_fdt_add_subnode(ms->fdt, nodename); |
26 | + } | 31 | + qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", "loongson,ls7a-rtc"); |
27 | + | 32 | + qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", 0x0, base, size); |
28 | + return 0; | 33 | + g_free(nodename); |
29 | +} | 34 | +} |
30 | + | 35 | + |
31 | +static int loongarch_pic_post_load(void *opaque, int version_id) | 36 | +static void fdt_add_uart_node(LoongArchMachineState *lams) |
32 | +{ | 37 | +{ |
33 | + LoongArchPICCommonState *s = (LoongArchPICCommonState *)opaque; | 38 | + char *nodename; |
34 | + LoongArchPICCommonClass *lpcc = LOONGARCH_PIC_COMMON_GET_CLASS(s); | 39 | + hwaddr base = VIRT_UART_BASE; |
40 | + hwaddr size = VIRT_UART_SIZE; | ||
41 | + MachineState *ms = MACHINE(lams); | ||
35 | + | 42 | + |
36 | + if (lpcc->post_load) { | 43 | + nodename = g_strdup_printf("/serial@%" PRIx64, base); |
37 | + return lpcc->post_load(s, version_id); | 44 | + qemu_fdt_add_subnode(ms->fdt, nodename); |
38 | + } | 45 | + qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", "ns16550a"); |
39 | + | 46 | + qemu_fdt_setprop_cells(ms->fdt, nodename, "reg", 0x0, base, 0x0, size); |
40 | + return 0; | 47 | + qemu_fdt_setprop_cell(ms->fdt, nodename, "clock-frequency", 100000000); |
48 | + g_free(nodename); | ||
41 | +} | 49 | +} |
42 | + | 50 | + |
43 | static void loongarch_pic_common_realize(DeviceState *dev, Error **errp) | 51 | static void create_fdt(LoongArchMachineState *lams) |
44 | { | 52 | { |
45 | LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(dev); | 53 | MachineState *ms = MACHINE(lams); |
46 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_loongarch_pic_common = { | 54 | @@ -XXX,XX +XXX,XX @@ static void loongarch_devices_init(DeviceState *pch_pic, LoongArchMachineState * |
47 | .name = "loongarch_pch_pic", | 55 | qdev_get_gpio_in(pch_pic, |
48 | .version_id = 1, | 56 | VIRT_UART_IRQ - PCH_PIC_IRQ_OFFSET), |
49 | .minimum_version_id = 1, | 57 | 115200, serial_hd(0), DEVICE_LITTLE_ENDIAN); |
50 | + .pre_save = loongarch_pic_pre_save, | 58 | + fdt_add_uart_node(lams); |
51 | + .post_load = loongarch_pic_post_load, | 59 | |
52 | .fields = (const VMStateField[]) { | 60 | /* Network init */ |
53 | VMSTATE_UINT64(int_mask, LoongArchPICCommonState), | 61 | for (i = 0; i < nb_nics; i++) { |
54 | VMSTATE_UINT64(htmsi_en, LoongArchPICCommonState), | 62 | @@ -XXX,XX +XXX,XX @@ static void loongarch_devices_init(DeviceState *pch_pic, LoongArchMachineState * |
55 | diff --git a/include/hw/intc/loongarch_pic_common.h b/include/hw/intc/loongarch_pic_common.h | 63 | sysbus_create_simple("ls7a_rtc", VIRT_RTC_REG_BASE, |
64 | qdev_get_gpio_in(pch_pic, | ||
65 | VIRT_RTC_IRQ - PCH_PIC_IRQ_OFFSET)); | ||
66 | + fdt_add_rtc_node(lams); | ||
67 | |||
68 | pm_mem = g_new(MemoryRegion, 1); | ||
69 | memory_region_init_io(pm_mem, NULL, &loongarch_virt_pm_ops, | ||
70 | diff --git a/include/hw/pci-host/ls7a.h b/include/hw/pci-host/ls7a.h | ||
56 | index XXXXXXX..XXXXXXX 100644 | 71 | index XXXXXXX..XXXXXXX 100644 |
57 | --- a/include/hw/intc/loongarch_pic_common.h | 72 | --- a/include/hw/pci-host/ls7a.h |
58 | +++ b/include/hw/intc/loongarch_pic_common.h | 73 | +++ b/include/hw/pci-host/ls7a.h |
59 | @@ -XXX,XX +XXX,XX @@ struct LoongArchPICCommonClass { | 74 | @@ -XXX,XX +XXX,XX @@ |
60 | SysBusDeviceClass parent_class; | 75 | #define VIRT_PCI_IRQS 48 |
61 | 76 | #define VIRT_UART_IRQ (PCH_PIC_IRQ_OFFSET + 2) | |
62 | DeviceRealize parent_realize; | 77 | #define VIRT_UART_BASE 0x1fe001e0 |
63 | + int (*pre_save)(LoongArchPICCommonState *s); | 78 | +#define VIRT_UART_SIZE 0X100 |
64 | + int (*post_load)(LoongArchPICCommonState *s, int version_id); | 79 | #define VIRT_RTC_IRQ (PCH_PIC_IRQ_OFFSET + 3) |
65 | }; | 80 | #define VIRT_MISC_REG_BASE (VIRT_PCH_REG_BASE + 0x00080000) |
66 | #endif /* HW_LOONGARCH_PIC_COMMON_H */ | 81 | #define VIRT_RTC_REG_BASE (VIRT_MISC_REG_BASE + 0x00050100) |
67 | -- | 82 | -- |
68 | 2.43.5 | 83 | 2.31.1 | diff view generated by jsdifflib |
1 | Remove definition about LoongArchPCHPIC and LOONGARCH_PCH_PIC, and | 1 | From: Xiaojuan Yang <yangxiaojuan@loongson.cn> |
---|---|---|---|
2 | replace them with LoongArchPICCommonState and LOONGARCH_PIC_COMMON | ||
3 | separately. Also remove unnecessary header files. | ||
4 | 2 | ||
5 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | 3 | Add TPM device for LoongArch virt machine, including |
4 | establish TPM acpi info and add TYPE_TPM_TIS_SYSBUS | ||
5 | to dynamic_sysbus_devices list. | ||
6 | |||
7 | Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn> | ||
6 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 8 | Reviewed-by: Song Gao <gaosong@loongson.cn> |
9 | Message-Id: <20221028014007.2718352-4-yangxiaojuan@loongson.cn> | ||
10 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
7 | --- | 11 | --- |
8 | hw/intc/loongarch_pch_pic.c | 24 ++++++++++-------------- | 12 | hw/loongarch/acpi-build.c | 51 ++++++++++++++++++++++++++++++++++++++- |
9 | hw/loongarch/virt.c | 2 +- | 13 | hw/loongarch/virt.c | 4 +++ |
10 | include/hw/intc/loongarch_pch_pic.h | 4 ---- | 14 | 2 files changed, 54 insertions(+), 1 deletion(-) |
11 | 3 files changed, 11 insertions(+), 19 deletions(-) | ||
12 | 15 | ||
13 | diff --git a/hw/intc/loongarch_pch_pic.c b/hw/intc/loongarch_pch_pic.c | 16 | diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c |
14 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/intc/loongarch_pch_pic.c | 18 | --- a/hw/loongarch/acpi-build.c |
16 | +++ b/hw/intc/loongarch_pch_pic.c | 19 | +++ b/hw/loongarch/acpi-build.c |
17 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ |
18 | 21 | ||
19 | #include "qemu/osdep.h" | 22 | #include "hw/acpi/generic_event_device.h" |
20 | #include "qemu/bitops.h" | 23 | #include "hw/pci-host/gpex.h" |
21 | -#include "hw/sysbus.h" | 24 | +#include "sysemu/tpm.h" |
22 | -#include "hw/loongarch/virt.h" | 25 | +#include "hw/platform-bus.h" |
23 | -#include "hw/pci-host/ls7a.h" | 26 | +#include "hw/acpi/aml-build.h" |
24 | #include "hw/irq.h" | 27 | |
25 | #include "hw/intc/loongarch_pch_pic.h" | 28 | #define ACPI_BUILD_ALIGN_SIZE 0x1000 |
26 | -#include "hw/qdev-properties.h" | 29 | #define ACPI_BUILD_TABLE_SIZE 0x20000 |
27 | -#include "migration/vmstate.h" | 30 | @@ -XXX,XX +XXX,XX @@ static void build_pci_device_aml(Aml *scope, LoongArchMachineState *lams) |
28 | #include "trace.h" | 31 | acpi_dsdt_add_gpex(scope, &cfg); |
29 | #include "qapi/error.h" | 32 | } |
30 | 33 | ||
31 | -static void pch_pic_update_irq(LoongArchPCHPIC *s, uint64_t mask, int level) | 34 | +#ifdef CONFIG_TPM |
32 | +static void pch_pic_update_irq(LoongArchPICCommonState *s, uint64_t mask, | 35 | +static void acpi_dsdt_add_tpm(Aml *scope, LoongArchMachineState *vms) |
33 | + int level) | 36 | +{ |
34 | { | 37 | + PlatformBusDevice *pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev); |
35 | uint64_t val; | 38 | + hwaddr pbus_base = VIRT_PLATFORM_BUS_BASEADDRESS; |
36 | int irq; | 39 | + SysBusDevice *sbdev = SYS_BUS_DEVICE(tpm_find()); |
37 | @@ -XXX,XX +XXX,XX @@ static void pch_pic_update_irq(LoongArchPCHPIC *s, uint64_t mask, int level) | 40 | + MemoryRegion *sbdev_mr; |
38 | 41 | + hwaddr tpm_base; | |
39 | static void pch_pic_irq_handler(void *opaque, int irq, int level) | 42 | + |
40 | { | 43 | + if (!sbdev) { |
41 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | 44 | + return; |
42 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque); | 45 | + } |
43 | uint64_t mask = 1ULL << irq; | 46 | + |
44 | 47 | + tpm_base = platform_bus_get_mmio_addr(pbus, sbdev, 0); | |
45 | assert(irq < s->irq_num); | 48 | + assert(tpm_base != -1); |
46 | @@ -XXX,XX +XXX,XX @@ static void pch_pic_irq_handler(void *opaque, int irq, int level) | 49 | + |
47 | static uint64_t loongarch_pch_pic_low_readw(void *opaque, hwaddr addr, | 50 | + tpm_base += pbus_base; |
48 | unsigned size) | 51 | + |
49 | { | 52 | + sbdev_mr = sysbus_mmio_get_region(sbdev, 0); |
50 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | 53 | + |
51 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque); | 54 | + Aml *dev = aml_device("TPM0"); |
52 | uint64_t val = 0; | 55 | + aml_append(dev, aml_name_decl("_HID", aml_string("MSFT0101"))); |
53 | uint32_t offset = addr & 0xfff; | 56 | + aml_append(dev, aml_name_decl("_STR", aml_string("TPM 2.0 Device"))); |
54 | 57 | + aml_append(dev, aml_name_decl("_UID", aml_int(0))); | |
55 | @@ -XXX,XX +XXX,XX @@ static uint64_t get_writew_val(uint64_t value, uint32_t target, bool hi) | 58 | + |
56 | static void loongarch_pch_pic_low_writew(void *opaque, hwaddr addr, | 59 | + Aml *crs = aml_resource_template(); |
57 | uint64_t value, unsigned size) | 60 | + aml_append(crs, |
58 | { | 61 | + aml_memory32_fixed(tpm_base, |
59 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | 62 | + (uint32_t)memory_region_size(sbdev_mr), |
60 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque); | 63 | + AML_READ_WRITE)); |
61 | uint32_t offset, old_valid, data = (uint32_t)value; | 64 | + aml_append(dev, aml_name_decl("_CRS", crs)); |
62 | uint64_t old, int_mask; | 65 | + aml_append(scope, dev); |
63 | offset = addr & 0xfff; | 66 | +} |
64 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_low_writew(void *opaque, hwaddr addr, | 67 | +#endif |
65 | static uint64_t loongarch_pch_pic_high_readw(void *opaque, hwaddr addr, | 68 | + |
66 | unsigned size) | 69 | /* build DSDT */ |
67 | { | 70 | static void |
68 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | 71 | build_dsdt(GArray *table_data, BIOSLinker *linker, MachineState *machine) |
69 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque); | 72 | @@ -XXX,XX +XXX,XX @@ build_dsdt(GArray *table_data, BIOSLinker *linker, MachineState *machine) |
70 | uint64_t val = 0; | 73 | build_uart_device_aml(dsdt); |
71 | uint32_t offset = addr & 0xfff; | 74 | build_pci_device_aml(dsdt, lams); |
72 | 75 | build_la_ged_aml(dsdt, machine); | |
73 | @@ -XXX,XX +XXX,XX @@ static uint64_t loongarch_pch_pic_high_readw(void *opaque, hwaddr addr, | 76 | - |
74 | static void loongarch_pch_pic_high_writew(void *opaque, hwaddr addr, | 77 | +#ifdef CONFIG_TPM |
75 | uint64_t value, unsigned size) | 78 | + acpi_dsdt_add_tpm(dsdt, lams); |
76 | { | 79 | +#endif |
77 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | 80 | /* System State Package */ |
78 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque); | 81 | scope = aml_scope("\\"); |
79 | uint32_t offset, data = (uint32_t)value; | 82 | pkg = aml_package(4); |
80 | offset = addr & 0xfff; | 83 | @@ -XXX,XX +XXX,XX @@ static void acpi_build(AcpiBuildTables *tables, MachineState *machine) |
81 | 84 | lams->oem_table_id); | |
82 | @@ -XXX,XX +XXX,XX @@ static void loongarch_pch_pic_high_writew(void *opaque, hwaddr addr, | 85 | } |
83 | static uint64_t loongarch_pch_pic_readb(void *opaque, hwaddr addr, | 86 | |
84 | unsigned size) | 87 | +#ifdef CONFIG_TPM |
85 | { | 88 | + /* TPM info */ |
86 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | 89 | + if (tpm_get_version(tpm_find()) == TPM_VERSION_2_0) { |
87 | + LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque); | 90 | + acpi_add_table(table_offsets, tables_blob); |
88 | uint64_t val = 0; | 91 | + build_tpm2(tables_blob, tables->linker, |
89 | uint32_t offset = (addr & 0xfff) + PCH_PIC_ROUTE_ENTRY_OFFSET; | 92 | + tables->tcpalog, lams->oem_id, |
90 | int64_t offset_tmp; | 93 | + lams->oem_table_id); |
91 | @@ -XXX,XX +XXX,XX @@ static uint64_t loongarch_pch_pic_readb(void *opaque, hwaddr addr, | 94 | + } |
92 | static void loongarch_pch_pic_writeb(void *opaque, hwaddr addr, | 95 | +#endif |
93 | uint64_t data, unsigned size) | 96 | /* Add tables supplied by user (if any) */ |
94 | { | 97 | for (u = acpi_table_first(); u; u = acpi_table_next(u)) { |
95 | - LoongArchPCHPIC *s = LOONGARCH_PCH_PIC(opaque); | 98 | unsigned len = acpi_table_len(u); |
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; | ||
109 | diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c | 99 | diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c |
110 | index XXXXXXX..XXXXXXX 100644 | 100 | index XXXXXXX..XXXXXXX 100644 |
111 | --- a/hw/loongarch/virt.c | 101 | --- a/hw/loongarch/virt.c |
112 | +++ b/hw/loongarch/virt.c | 102 | +++ b/hw/loongarch/virt.c |
113 | @@ -XXX,XX +XXX,XX @@ static void virt_irq_init(LoongArchVirtMachineState *lvms) | 103 | @@ -XXX,XX +XXX,XX @@ |
114 | /* Add Extend I/O Interrupt Controller node */ | 104 | #include "hw/platform-bus.h" |
115 | fdt_add_eiointc_node(lvms, &cpuintc_phandle, &eiointc_phandle); | 105 | #include "hw/display/ramfb.h" |
116 | 106 | #include "hw/mem/pc-dimm.h" | |
117 | - pch_pic = qdev_new(TYPE_LOONGARCH_PCH_PIC); | 107 | +#include "sysemu/tpm.h" |
118 | + pch_pic = qdev_new(TYPE_LOONGARCH_PIC); | 108 | |
119 | num = VIRT_PCH_PIC_IRQ_NUM; | 109 | static void fdt_add_rtc_node(LoongArchMachineState *lams) |
120 | qdev_prop_set_uint32(pch_pic, "pch_pic_irq_num", num); | 110 | { |
121 | d = SYS_BUS_DEVICE(pch_pic); | 111 | @@ -XXX,XX +XXX,XX @@ static void loongarch_class_init(ObjectClass *oc, void *data) |
122 | diff --git a/include/hw/intc/loongarch_pch_pic.h b/include/hw/intc/loongarch_pch_pic.h | 112 | object_class_property_set_description(oc, "acpi", |
123 | index XXXXXXX..XXXXXXX 100644 | 113 | "Enable ACPI"); |
124 | --- a/include/hw/intc/loongarch_pch_pic.h | 114 | machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); |
125 | +++ b/include/hw/intc/loongarch_pch_pic.h | 115 | +#ifdef CONFIG_TPM |
126 | @@ -XXX,XX +XXX,XX @@ struct LoongarchPICClass { | 116 | + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); |
127 | DeviceRealize parent_realize; | 117 | +#endif |
128 | }; | 118 | } |
129 | 119 | ||
130 | -#define TYPE_LOONGARCH_PCH_PIC TYPE_LOONGARCH_PIC | 120 | static const TypeInfo loongarch_machine_types[] = { |
131 | -typedef struct LoongArchPICCommonState LoongArchPCHPIC; | ||
132 | -#define LOONGARCH_PCH_PIC(obj) ((struct LoongArchPICCommonState *)(obj)) | ||
133 | - | ||
134 | #endif /* HW_LOONGARCH_PCH_PIC_H */ | ||
135 | -- | 121 | -- |
136 | 2.43.5 | 122 | 2.31.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Add common header file include/hw/intc/loongarch_extioi_common.h, and | ||
2 | move some macro definition from include/hw/intc/loongarch_extioi.h to | ||
3 | the common header file. | ||
4 | 1 | ||
5 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | ||
6 | Reviewed-by: Song Gao <gaosong@loongson.cn> | ||
7 | --- | ||
8 | include/hw/intc/loongarch_extioi.h | 50 +------------------ | ||
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 | ||
12 | |||
13 | diff --git a/include/hw/intc/loongarch_extioi.h b/include/hw/intc/loongarch_extioi.h | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/include/hw/intc/loongarch_extioi.h | ||
16 | +++ b/include/hw/intc/loongarch_extioi.h | ||
17 | @@ -XXX,XX +XXX,XX @@ | ||
18 | * Copyright (C) 2021 Loongson Technology Corporation Limited | ||
19 | */ | ||
20 | |||
21 | -#include "hw/sysbus.h" | ||
22 | -#include "hw/loongarch/virt.h" | ||
23 | - | ||
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 */ | ||
141 | -- | ||
142 | 2.43.5 | diff view generated by jsdifflib |
1 | Rename structure LoongArchExtIOI with LoongArchExtIOICommonState, | 1 | We need subcodes to distinguish the same excode cs->exception_indexs, |
---|---|---|---|
2 | since it is defined in file loongarch_extioi_common.h | 2 | such as EXCCODE_ADEF/EXCCODE_ADEM. |
3 | 3 | ||
4 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | 4 | Signed-off-by: Song Gao <gaosong@loongson.cn> |
5 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-ID: <20221101073210.3934280-1-gaosong@loongson.cn> | ||
6 | --- | 7 | --- |
7 | include/hw/intc/loongarch_extioi.h | 1 + | 8 | target/loongarch/cpu.c | 7 +++-- |
8 | include/hw/intc/loongarch_extioi_common.h | 2 +- | 9 | target/loongarch/cpu.h | 58 ++++++++++++++++++++++-------------------- |
9 | 2 files changed, 2 insertions(+), 1 deletion(-) | 10 | 2 files changed, 36 insertions(+), 29 deletions(-) |
10 | 11 | ||
11 | diff --git a/include/hw/intc/loongarch_extioi.h b/include/hw/intc/loongarch_extioi.h | 12 | diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c |
12 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/include/hw/intc/loongarch_extioi.h | 14 | --- a/target/loongarch/cpu.c |
14 | +++ b/include/hw/intc/loongarch_extioi.h | 15 | +++ b/target/loongarch/cpu.c |
15 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ static void loongarch_cpu_do_interrupt(CPUState *cs) |
16 | 17 | env->CSR_TLBRERA = FIELD_DP64(env->CSR_TLBRERA, CSR_TLBRERA, | |
17 | #include "hw/intc/loongarch_extioi_common.h" | 18 | PC, (env->pc >> 2)); |
18 | 19 | } else { | |
19 | +#define LoongArchExtIOI LoongArchExtIOICommonState | 20 | - env->CSR_ESTAT = FIELD_DP64(env->CSR_ESTAT, CSR_ESTAT, ECODE, cause); |
20 | #define TYPE_LOONGARCH_EXTIOI "loongarch.extioi" | 21 | + env->CSR_ESTAT = FIELD_DP64(env->CSR_ESTAT, CSR_ESTAT, ECODE, |
21 | OBJECT_DECLARE_SIMPLE_TYPE(LoongArchExtIOI, LOONGARCH_EXTIOI) | 22 | + EXCODE_MCODE(cause)); |
22 | #endif /* LOONGARCH_EXTIOI_H */ | 23 | + env->CSR_ESTAT = FIELD_DP64(env->CSR_ESTAT, CSR_ESTAT, ESUBCODE, |
23 | diff --git a/include/hw/intc/loongarch_extioi_common.h b/include/hw/intc/loongarch_extioi_common.h | 24 | + EXCODE_SUBCODE(cause)); |
25 | env->CSR_PRMD = FIELD_DP64(env->CSR_PRMD, CSR_PRMD, PPLV, | ||
26 | FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PLV)); | ||
27 | env->CSR_PRMD = FIELD_DP64(env->CSR_PRMD, CSR_PRMD, PIE, | ||
28 | @@ -XXX,XX +XXX,XX @@ static void loongarch_cpu_do_interrupt(CPUState *cs) | ||
29 | env->pc = env->CSR_TLBRENTRY; | ||
30 | } else { | ||
31 | env->pc = env->CSR_EENTRY; | ||
32 | - env->pc += cause * vec_size; | ||
33 | + env->pc += EXCODE_MCODE(cause) * vec_size; | ||
34 | } | ||
35 | qemu_log_mask(CPU_LOG_INT, | ||
36 | "%s: PC " TARGET_FMT_lx " ERA " TARGET_FMT_lx | ||
37 | diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h | ||
24 | index XXXXXXX..XXXXXXX 100644 | 38 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/include/hw/intc/loongarch_extioi_common.h | 39 | --- a/target/loongarch/cpu.h |
26 | +++ b/include/hw/intc/loongarch_extioi_common.h | 40 | +++ b/target/loongarch/cpu.h |
27 | @@ -XXX,XX +XXX,XX @@ typedef struct ExtIOICore { | 41 | @@ -XXX,XX +XXX,XX @@ FIELD(FCSR0, CAUSE, 24, 5) |
28 | qemu_irq parent_irq[LS3A_INTC_IP]; | 42 | #define FP_DIV0 8 |
29 | } ExtIOICore; | 43 | #define FP_INVALID 16 |
30 | 44 | ||
31 | -struct LoongArchExtIOI { | 45 | -#define EXCCODE_EXTERNAL_INT 64 /* plus external interrupt number */ |
32 | +struct LoongArchExtIOICommonState { | 46 | -#define EXCCODE_INT 0 |
33 | SysBusDevice parent_obj; | 47 | -#define EXCCODE_PIL 1 |
34 | uint32_t num_cpu; | 48 | -#define EXCCODE_PIS 2 |
35 | uint32_t features; | 49 | -#define EXCCODE_PIF 3 |
50 | -#define EXCCODE_PME 4 | ||
51 | -#define EXCCODE_PNR 5 | ||
52 | -#define EXCCODE_PNX 6 | ||
53 | -#define EXCCODE_PPI 7 | ||
54 | -#define EXCCODE_ADEF 8 /* Different exception subcode */ | ||
55 | -#define EXCCODE_ADEM 8 | ||
56 | -#define EXCCODE_ALE 9 | ||
57 | -#define EXCCODE_BCE 10 | ||
58 | -#define EXCCODE_SYS 11 | ||
59 | -#define EXCCODE_BRK 12 | ||
60 | -#define EXCCODE_INE 13 | ||
61 | -#define EXCCODE_IPE 14 | ||
62 | -#define EXCCODE_FPD 15 | ||
63 | -#define EXCCODE_SXD 16 | ||
64 | -#define EXCCODE_ASXD 17 | ||
65 | -#define EXCCODE_FPE 18 /* Different exception subcode */ | ||
66 | -#define EXCCODE_VFPE 18 | ||
67 | -#define EXCCODE_WPEF 19 /* Different exception subcode */ | ||
68 | -#define EXCCODE_WPEM 19 | ||
69 | -#define EXCCODE_BTD 20 | ||
70 | -#define EXCCODE_BTE 21 | ||
71 | -#define EXCCODE_DBP 26 /* Reserved subcode used for debug */ | ||
72 | +#define EXCODE(code, subcode) ( ((subcode) << 6) | (code) ) | ||
73 | +#define EXCODE_MCODE(code) ( (code) & 0x3f ) | ||
74 | +#define EXCODE_SUBCODE(code) ( (code) >> 6 ) | ||
75 | + | ||
76 | +#define EXCCODE_EXTERNAL_INT 64 /* plus external interrupt number */ | ||
77 | +#define EXCCODE_INT EXCODE(0, 0) | ||
78 | +#define EXCCODE_PIL EXCODE(1, 0) | ||
79 | +#define EXCCODE_PIS EXCODE(2, 0) | ||
80 | +#define EXCCODE_PIF EXCODE(3, 0) | ||
81 | +#define EXCCODE_PME EXCODE(4, 0) | ||
82 | +#define EXCCODE_PNR EXCODE(5, 0) | ||
83 | +#define EXCCODE_PNX EXCODE(6, 0) | ||
84 | +#define EXCCODE_PPI EXCODE(7, 0) | ||
85 | +#define EXCCODE_ADEF EXCODE(8, 0) /* Different exception subcode */ | ||
86 | +#define EXCCODE_ADEM EXCODE(8, 1) | ||
87 | +#define EXCCODE_ALE EXCODE(9, 0) | ||
88 | +#define EXCCODE_BCE EXCODE(10, 0) | ||
89 | +#define EXCCODE_SYS EXCODE(11, 0) | ||
90 | +#define EXCCODE_BRK EXCODE(12, 0) | ||
91 | +#define EXCCODE_INE EXCODE(13, 0) | ||
92 | +#define EXCCODE_IPE EXCODE(14, 0) | ||
93 | +#define EXCCODE_FPD EXCODE(15, 0) | ||
94 | +#define EXCCODE_SXD EXCODE(16, 0) | ||
95 | +#define EXCCODE_ASXD EXCODE(17, 0) | ||
96 | +#define EXCCODE_FPE EXCODE(18, 0) /* Different exception subcode */ | ||
97 | +#define EXCCODE_VFPE EXCODE(18, 1) | ||
98 | +#define EXCCODE_WPEF EXCODE(19, 0) /* Different exception subcode */ | ||
99 | +#define EXCCODE_WPEM EXCODE(19, 1) | ||
100 | +#define EXCCODE_BTD EXCODE(20, 0) | ||
101 | +#define EXCCODE_BTE EXCODE(21, 0) | ||
102 | +#define EXCCODE_DBP EXCODE(26, 0) /* Reserved subcode used for debug */ | ||
103 | |||
104 | /* cpucfg[0] bits */ | ||
105 | FIELD(CPUCFG0, PRID, 0, 32) | ||
36 | -- | 106 | -- |
37 | 2.43.5 | 107 | 2.31.1 | diff view generated by jsdifflib |
1 | Move definiton of structure LoongArchExtIOI from header file loongarch_extioi.h | 1 | When the address is invalid address, We should set exception_index |
---|---|---|---|
2 | to file loongarch_extioi_common.h. | 2 | according to MMUAccessType, and EXCCODE_ADEF need't update badinstr. |
3 | Otherwise, The system enters an infinite loop. e.g: | ||
4 | run test.c on system mode | ||
5 | test.c: | ||
6 | #include<stdio.h> | ||
3 | 7 | ||
4 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | 8 | void (*func)(int *); |
5 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 9 | |
10 | int main() | ||
11 | { | ||
12 | int i = 8; | ||
13 | void *ptr = (void *)0x4000000000000000; | ||
14 | func = ptr; | ||
15 | func(&i); | ||
16 | return 0; | ||
17 | } | ||
18 | |||
19 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
20 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
21 | Message-ID: <20221101073210.3934280-2-gaosong@loongson.cn> | ||
6 | --- | 22 | --- |
7 | include/hw/intc/loongarch_extioi.h | 26 ---------------------- | 23 | target/loongarch/cpu.c | 1 + |
8 | include/hw/intc/loongarch_extioi_common.h | 27 +++++++++++++++++++++++ | 24 | target/loongarch/tlb_helper.c | 5 +++-- |
9 | 2 files changed, 27 insertions(+), 26 deletions(-) | 25 | 2 files changed, 4 insertions(+), 2 deletions(-) |
10 | 26 | ||
11 | diff --git a/include/hw/intc/loongarch_extioi.h b/include/hw/intc/loongarch_extioi.h | 27 | diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c |
12 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/include/hw/intc/loongarch_extioi.h | 29 | --- a/target/loongarch/cpu.c |
14 | +++ b/include/hw/intc/loongarch_extioi.h | 30 | +++ b/target/loongarch/cpu.c |
15 | @@ -XXX,XX +XXX,XX @@ | 31 | @@ -XXX,XX +XXX,XX @@ static void loongarch_cpu_do_interrupt(CPUState *cs) |
16 | 32 | } | |
17 | #include "hw/intc/loongarch_extioi_common.h" | 33 | QEMU_FALLTHROUGH; |
18 | 34 | case EXCCODE_PIF: | |
19 | -typedef struct ExtIOICore { | 35 | + case EXCCODE_ADEF: |
20 | - uint32_t coreisr[EXTIOI_IRQS_GROUP_COUNT]; | 36 | cause = cs->exception_index; |
21 | - DECLARE_BITMAP(sw_isr[LS3A_INTC_IP], EXTIOI_IRQS); | 37 | update_badinstr = 0; |
22 | - qemu_irq parent_irq[LS3A_INTC_IP]; | 38 | break; |
23 | -} ExtIOICore; | 39 | diff --git a/target/loongarch/tlb_helper.c b/target/loongarch/tlb_helper.c |
24 | - | ||
25 | #define TYPE_LOONGARCH_EXTIOI "loongarch.extioi" | ||
26 | OBJECT_DECLARE_SIMPLE_TYPE(LoongArchExtIOI, LOONGARCH_EXTIOI) | ||
27 | -struct LoongArchExtIOI { | ||
28 | - SysBusDevice parent_obj; | ||
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 | 40 | index XXXXXXX..XXXXXXX 100644 |
50 | --- a/include/hw/intc/loongarch_extioi_common.h | 41 | --- a/target/loongarch/tlb_helper.c |
51 | +++ b/include/hw/intc/loongarch_extioi_common.h | 42 | +++ b/target/loongarch/tlb_helper.c |
52 | @@ -XXX,XX +XXX,XX @@ | 43 | @@ -XXX,XX +XXX,XX @@ static void raise_mmu_exception(CPULoongArchState *env, target_ulong address, |
53 | #define EXTIOI_ENABLE_CPU_ENCODE (3) | 44 | switch (tlb_error) { |
54 | #define EXTIOI_VIRT_COREMAP_START (0x40) | 45 | default: |
55 | #define EXTIOI_VIRT_COREMAP_END (0x240) | 46 | case TLBRET_BADADDR: |
56 | + | 47 | - cs->exception_index = EXCCODE_ADEM; |
57 | +typedef struct ExtIOICore { | 48 | + cs->exception_index = access_type == MMU_INST_FETCH |
58 | + uint32_t coreisr[EXTIOI_IRQS_GROUP_COUNT]; | 49 | + ? EXCCODE_ADEF : EXCCODE_ADEM; |
59 | + DECLARE_BITMAP(sw_isr[LS3A_INTC_IP], EXTIOI_IRQS); | 50 | break; |
60 | + qemu_irq parent_irq[LS3A_INTC_IP]; | 51 | case TLBRET_NOMATCH: |
61 | +} ExtIOICore; | 52 | /* No TLB match for a mapped address */ |
62 | + | 53 | @@ -XXX,XX +XXX,XX @@ bool loongarch_cpu_tlb_fill(CPUState *cs, vaddr address, int size, |
63 | +struct LoongArchExtIOI { | 54 | CPULoongArchState *env = &cpu->env; |
64 | + SysBusDevice parent_obj; | 55 | hwaddr physical; |
65 | + uint32_t num_cpu; | 56 | int prot; |
66 | + uint32_t features; | 57 | - int ret = TLBRET_BADADDR; |
67 | + uint32_t status; | 58 | + int ret; |
68 | + /* hardware state */ | 59 | |
69 | + uint32_t nodetype[EXTIOI_IRQS_NODETYPE_COUNT / 2]; | 60 | /* Data access */ |
70 | + uint32_t bounce[EXTIOI_IRQS_GROUP_COUNT]; | 61 | ret = get_physical_address(env, &physical, &prot, address, |
71 | + uint32_t isr[EXTIOI_IRQS / 32]; | ||
72 | + uint32_t enable[EXTIOI_IRQS / 32]; | ||
73 | + uint32_t ipmap[EXTIOI_IRQS_IPMAP_SIZE / 4]; | ||
74 | + uint32_t coremap[EXTIOI_IRQS / 4]; | ||
75 | + uint32_t sw_pending[EXTIOI_IRQS / 32]; | ||
76 | + uint8_t sw_ipmap[EXTIOI_IRQS_IPMAP_SIZE]; | ||
77 | + uint8_t sw_coremap[EXTIOI_IRQS]; | ||
78 | + qemu_irq irq[EXTIOI_IRQS]; | ||
79 | + ExtIOICore *cpu; | ||
80 | + MemoryRegion extioi_system_mem; | ||
81 | + MemoryRegion virt_extend; | ||
82 | +}; | ||
83 | #endif /* LOONGARCH_EXTIOI_H */ | ||
84 | -- | 62 | -- |
85 | 2.43.5 | 63 | 2.31.1 | diff view generated by jsdifflib |