diff --git a/arch/sw_64/Kconfig b/arch/sw_64/Kconfig index 36cddefb1ad4bcdb734b0bbfe14adee8f0f6f92d..b37a4f4e093e7675366ee85964c8656cfce294b8 100644 --- a/arch/sw_64/Kconfig +++ b/arch/sw_64/Kconfig @@ -2,40 +2,13 @@ config SW64 bool default y - select AUDIT_ARCH - select HAVE_IDE - select HAVE_OPROFILE - select HAVE_PCSPKR_PLATFORM - select HAVE_PERF_EVENTS - select HAVE_FAST_GUP - select GENERIC_CLOCKEVENTS - select GENERIC_IRQ_PROBE - select GENERIC_IRQ_LEGACY - select GENERIC_IRQ_SHOW - select ARCH_WANT_IPC_PARSE_VERSION - select ARCH_HAVE_NMI_SAFE_CMPXCHG - select ARCH_NO_PREEMPT - select ARCH_USE_CMPXCHG_LOCKREF - select GENERIC_SMP_IDLE_THREAD - select HAVE_MOD_ARCH_SPECIFIC - select MODULES_USE_ELF_RELA - select ARCH_SUPPORTS_NUMA_BALANCING - select HAVE_ARCH_TRANSPARENT_HUGEPAGE - select HAVE_ARCH_AUDITSYSCALL - select HAVE_ARCH_SECCOMP_FILTER - select OLD_SIGSUSPEND - select GENERIC_STRNCPY_FROM_USER - select GENERIC_STRNLEN_USER - select HAVE_ARCH_KGDB + select ACPI + select ACPI_REDUCED_HARDWARE_ONLY + select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_PHYS_TO_DMA - select SWIOTLB - select HAVE_MEMBLOCK - select HAVE_MEMBLOCK_NODE_MAP - select NO_BOOTMEM - select ARCH_USE_QUEUED_RWLOCKS - select ARCH_USE_QUEUED_SPINLOCKS - select COMMON_CLK - select HANDLE_DOMAIN_IRQ + select ARCH_HAS_PTE_SPECIAL + select ARCH_HAS_SG_CHAIN + select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_INLINE_READ_LOCK select ARCH_INLINE_READ_LOCK_BH select ARCH_INLINE_READ_LOCK_IRQ @@ -44,60 +17,88 @@ config SW64 select ARCH_INLINE_READ_UNLOCK_BH select ARCH_INLINE_READ_UNLOCK_IRQ select ARCH_INLINE_READ_UNLOCK_IRQRESTORE - select ARCH_INLINE_WRITE_LOCK - select ARCH_INLINE_WRITE_LOCK_BH - select ARCH_INLINE_WRITE_LOCK_IRQ - select ARCH_INLINE_WRITE_LOCK_IRQSAVE - select ARCH_INLINE_WRITE_UNLOCK - select ARCH_INLINE_WRITE_UNLOCK_BH - select ARCH_INLINE_WRITE_UNLOCK_IRQ - select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE - select ARCH_INLINE_SPIN_TRYLOCK - select ARCH_INLINE_SPIN_TRYLOCK_BH select ARCH_INLINE_SPIN_LOCK select ARCH_INLINE_SPIN_LOCK_BH select ARCH_INLINE_SPIN_LOCK_IRQ select ARCH_INLINE_SPIN_LOCK_IRQSAVE + select ARCH_INLINE_SPIN_TRYLOCK + select ARCH_INLINE_SPIN_TRYLOCK_BH select ARCH_INLINE_SPIN_UNLOCK select ARCH_INLINE_SPIN_UNLOCK_BH select ARCH_INLINE_SPIN_UNLOCK_IRQ select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE + select ARCH_INLINE_WRITE_LOCK + select ARCH_INLINE_WRITE_LOCK_BH + select ARCH_INLINE_WRITE_LOCK_IRQ + select ARCH_INLINE_WRITE_LOCK_IRQSAVE + select ARCH_INLINE_WRITE_UNLOCK + select ARCH_INLINE_WRITE_UNLOCK_BH + select ARCH_INLINE_WRITE_UNLOCK_IRQ + select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE + select ARCH_NO_PREEMPT + select ARCH_SUPPORTS_ACPI select ARCH_SUPPORTS_ATOMIC_RMW - select ARCH_HAS_SG_CHAIN - select IRQ_FORCED_THREADING + select ARCH_SUPPORTS_NUMA_BALANCING + select ARCH_SUPPORTS_UPROBES + select ARCH_USE_CMPXCHG_LOCKREF + select ARCH_USE_QUEUED_RWLOCKS + select ARCH_USE_QUEUED_SPINLOCKS + select ARCH_WANT_FRAME_POINTERS + select ARCH_WANT_IPC_PARSE_VERSION + select AUDIT_ARCH + select COMMON_CLK + select DMA_OPS if PCI + select GENERIC_CLOCKEVENTS + select GENERIC_IRQ_LEGACY select GENERIC_IRQ_MIGRATION if SMP + select GENERIC_IRQ_PROBE + select GENERIC_IRQ_SHOW + select GENERIC_PCI_IOMAP if PCI + select GENERIC_SMP_IDLE_THREAD + select GENERIC_STRNCPY_FROM_USER + select GENERIC_STRNLEN_USER + select GENERIC_TIME_VSYSCALL + select HANDLE_DOMAIN_IRQ + select HARDIRQS_SW_RESEND + select HAVE_ARCH_AUDITSYSCALL + select HAVE_ARCH_JUMP_LABEL + select HAVE_ARCH_KGDB + select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_TRACEHOOK - select HAVE_FUNCTION_TRACER + select HAVE_ARCH_TRANSPARENT_HUGEPAGE + select HAVE_ASM_MODVERSIONS + select HAVE_C_RECORDMCOUNT + select HAVE_DEBUG_BUGVERBOSE select HAVE_DYNAMIC_FTRACE + select HAVE_EBPF_JIT + select HAVE_FAST_GUP select HAVE_FTRACE_MCOUNT_RECORD - select HAVE_C_RECORDMCOUNT select HAVE_FUNCTION_GRAPH_TRACER + select HAVE_FUNCTION_TRACER + select HAVE_IDE select HAVE_KPROBES select HAVE_KRETPROBES - select HAVE_SYSCALL_TRACEPOINTS - select ARCH_SUPPORTS_UPROBES - select OF_EARLY_FLATTREE if OF - select HAVE_EBPF_JIT - select SPARSEMEM_EXTREME if SPARSEMEM - select HAVE_ARCH_JUMP_LABEL - select ARCH_WANT_FRAME_POINTERS - select HAVE_ASM_MODVERSIONS - select ARCH_HAS_ELF_RANDOMIZE - select HAVE_PERF_USER_STACK_DUMP - select HAVE_PERF_REGS - select ARCH_SUPPORTS_ACPI - select ACPI - select ACPI_REDUCED_HARDWARE_ONLY - select GENERIC_TIME_VSYSCALL - select SET_FS + select HAVE_MEMBLOCK + select HAVE_MEMBLOCK_NODE_MAP + select HAVE_MOD_ARCH_SPECIFIC + select HAVE_OPROFILE select HAVE_PCI - select GENERIC_PCI_IOMAP if PCI - select PCI_MSI_ARCH_FALLBACKS - select DMA_OPS if PCI + select HAVE_PCSPKR_PLATFORM + select HAVE_PERF_EVENTS + select HAVE_PERF_REGS + select HAVE_PERF_USER_STACK_DUMP select HAVE_REGS_AND_STACK_ACCESS_API - select ARCH_HAS_PTE_SPECIAL - select HARDIRQS_SW_RESEND + select HAVE_SYSCALL_TRACEPOINTS + select IRQ_FORCED_THREADING select MEMORY_HOTPLUG_SPARSE if MEMORY_HOTPLUG + select MODULES_USE_ELF_RELA + select NO_BOOTMEM + select OF_EARLY_FLATTREE if OF + select OLD_SIGSUSPEND + select PCI_MSI_ARCH_FALLBACKS + select SET_FS + select SPARSEMEM_EXTREME if SPARSEMEM + select SWIOTLB config LOCKDEP_SUPPORT def_bool y @@ -875,6 +876,12 @@ config SW64_SUSPEND_DEEPSLEEP_BOOTCORE bool "SW64 bootcore suspend into deep sleep mode" default n +config SW64_SUPPORT_S3_SLEEPING_STATE + depends on SUSPEND + bool "SW64 support S3 sleeping state" + default n + help + Only SW831 support S3 sleep option and needs SROM, HMCode and BIOS support. source "drivers/cpuidle/Kconfig" diff --git a/arch/sw_64/chip/chip3/chip.c b/arch/sw_64/chip/chip3/chip.c index 105389d5989fe7d2f81ad5da3e229cf122f1885e..d0b1c1c1c6df7ac3a95c1a78832477aee58e2c11 100644 --- a/arch/sw_64/chip/chip3/chip.c +++ b/arch/sw_64/chip/chip3/chip.c @@ -493,6 +493,172 @@ static void chip3_device_interrupt(unsigned long irq_info) } } +static void chip3_i2c_srst(void) +{ + sw64_io_write(0, I2C0_SRST_L, 0x0); + sw64_io_write(0, I2C0_SRST_L, 0x1); + + sw64_io_write(0, I2C1_SRST_L, 0x0); + sw64_io_write(0, I2C1_SRST_L, 0x1); + + sw64_io_write(0, I2C2_SRST_L, 0x0); + sw64_io_write(0, I2C2_SRST_L, 0x1); +} + +static void chip3_pcie_save(void) +{ + struct pci_controller *hose; + struct piu_saved *piu_save; + unsigned long node, index; + unsigned long i; + + for (hose = hose_head; hose; hose = hose->next) { + piu_save = kzalloc(sizeof(*piu_save), GFP_KERNEL); + + node = hose->node; + index = hose->index; + hose->sysdata = piu_save; + + piu_save->piuconfig0 = read_piu_ior0(node, index, PIUCONFIG0); + piu_save->piuconfig1 = read_piu_ior1(node, index, PIUCONFIG1); + piu_save->epdmabar = read_piu_ior0(node, index, EPDMABAR); + piu_save->msiaddr = read_piu_ior0(node, index, MSIADDR); + + for (i = 0; i < 256; i++) { + piu_save->msiconfig[i] = read_piu_ior0(node, index, + MSICONFIG0 + (i << 7)); + } + } +} + +static void chip3_pcie_restore(void) +{ + struct pci_controller *hose; + struct piu_saved *piu_save; + unsigned long node, index; + u32 rc_misc_ctrl; + unsigned int value; + unsigned long i; + + for (hose = hose_head; hose; hose = hose->next) { + node = hose->node; + index = hose->index; + piu_save = hose->sysdata; + + write_piu_ior0(node, index, PIUCONFIG0, piu_save->piuconfig0); + write_piu_ior1(node, index, PIUCONFIG1, piu_save->piuconfig1); + write_piu_ior0(node, index, EPDMABAR, piu_save->epdmabar); + write_piu_ior0(node, index, MSIADDR, piu_save->msiaddr); + + for (i = 0; i < 256; i++) { + write_piu_ior0(node, index, MSICONFIG0 + (i << 7), + piu_save->msiconfig[i]); + } + + /* Enable DBI_RO_WR_EN */ + rc_misc_ctrl = read_rc_conf(node, index, RC_MISC_CONTROL_1); + write_rc_conf(node, index, RC_MISC_CONTROL_1, rc_misc_ctrl | 0x1); + + /* Fix up DEVICE_ID_VENDOR_ID register */ + value = (PCI_DEVICE_ID_CHIP3 << 16) | PCI_VENDOR_ID_JN; + write_rc_conf(node, index, RC_VENDOR_ID, value); + + /* Set PCI-E root class code */ + value = read_rc_conf(node, index, RC_REVISION_ID); + write_rc_conf(node, index, RC_REVISION_ID, (PCI_CLASS_BRIDGE_HOST << 16) | value); + + /* Disable DBI_RO_WR_EN */ + write_rc_conf(node, index, RC_MISC_CONTROL_1, rc_misc_ctrl); + } + +} + +static unsigned long saved_dvc_int, saved_long_time; + +static inline void chip3_intpu_save(void) +{ + saved_long_time = sw64_io_read(0, LONG_TIME); +} + +static inline void chip3_intpu_restore(void) +{ + switch (cpu_desc.model) { + case CPU_SW831: + sw64_io_write(0, LONG_TIME, saved_long_time); + sw64_io_write(0, LONG_TIME_START_EN, 0x1); + break; + default: + pr_info("long time start is disable!"); + break; + } +} + +static inline void chip3_spbu_save(void) +{ + saved_dvc_int = sw64_io_read(0, MCU_DVC_INT_EN); +} + +static inline void chip3_spbu_restore(void) +{ + chip3_i2c_srst(); + sw64_io_write(0, MCU_DVC_INT_EN, saved_dvc_int); +} + +#define BIOS_SECBIN 0x2F00000UL +#define BIOS_SECSIZE 0x40000UL +#define BOUNCE_BUFFER ((1UL<<32) - BIOS_SECSIZE) +#define BIOS_MEMSAVE ((1UL<<32) - 2 * BIOS_SECSIZE) + +/* + * Due to specific architecture PCI MEM32 addressing, we reserve 512M memory + * size at PCI_32BIT_MEMIO (0xE000_0000) on SW64 platform. + * + * Since this memory region is still usable by OS, we implement a interface + * contract between BIOS and kernel: + * + * Firstly BIOS should back up SEC relative code segment to BIOS_MEMSAVE region + * with the length BIOS_SECSIZE in order to restore BIOS SEC phase binary during + * S3 sleep. + * + * Secondly kernel should use a bounce buffer to save memory region which may be + * overwritten by BIOS on resume from S3 sleep. + */ +static void chip3_mem_restore(void) +{ + void *dst, *src; + unsigned long size = BIOS_SECSIZE; + + /* Firstly kernel back up to a bounce buffer */ + src = __va(BIOS_SECBIN); + dst = __va(BOUNCE_BUFFER); + memcpy(dst, src, size); + + /* Secondly restore BIOS SEC phase binary */ + src = __va(BIOS_MEMSAVE); + dst = __va(BIOS_SECBIN); + memcpy(dst, src, size); +} + +extern void cpld_write(uint8_t slave_addr, uint8_t reg, uint8_t data); + +static void chip3_suspend(bool wakeup) +{ + + if (wakeup) { + chip3_pcie_restore(); + chip3_intpu_restore(); + chip3_spbu_restore(); + } else { + /* Set S3 flag */ + cpld_write(0x64, 0x34, 0x33); + + chip3_spbu_save(); + chip3_intpu_save(); + chip3_pcie_save(); + chip3_mem_restore(); + } +} + static void chip3_hose_init(struct pci_controller *hose) { unsigned long pci_io_base; @@ -574,6 +740,7 @@ static struct sw64_chip_init_ops chip3_chip_init_ops = { static struct sw64_chip_ops chip3_chip_ops = { .get_cpu_num = chip3_get_cpu_nums, + .suspend = chip3_suspend, .fixup = chip3_ops_fixup, }; diff --git a/arch/sw_64/chip/chip3/cpufreq_debugfs.c b/arch/sw_64/chip/chip3/cpufreq_debugfs.c index 13696360ef0294dd02cea16aa70cc31d2f6cb043..c58f1cee3907bd33b00a0c9ec49c664a5ff9e250 100644 --- a/arch/sw_64/chip/chip3/cpufreq_debugfs.c +++ b/arch/sw_64/chip/chip3/cpufreq_debugfs.c @@ -7,15 +7,15 @@ #include #include -#define CLK_PRT 0x1UL -#define CORE_CLK0_V (0x1UL << 1) -#define CORE_CLK0_R (0x1UL << 2) -#define CORE_CLK2_V (0x1UL << 15) -#define CORE_CLK2_R (0x1UL << 16) - -#define CLK_LV1_SEL_PRT 0x1UL -#define CLK_LV1_SEL_MUXA (0x1UL << 2) -#define CLK_LV1_SEL_MUXB (0x1UL << 3) +#define CLK_PRT 0x1UL +#define CORE_CLK0_V (0x1UL << 1) +#define CORE_CLK0_R (0x1UL << 2) +#define CORE_CLK2_V (0x1UL << 15) +#define CORE_CLK2_R (0x1UL << 16) + +#define CLK_LV1_SEL_PRT 0x1UL +#define CLK_LV1_SEL_MUXA (0x1UL << 2) +#define CLK_LV1_SEL_MUXB (0x1UL << 3) #define CORE_PLL0_CFG_SHIFT 4 #define CORE_PLL2_CFG_SHIFT 18 diff --git a/arch/sw_64/configs/openeuler_defconfig b/arch/sw_64/configs/openeuler_defconfig index 0e77721dae36685d5aa67b3482581fc50fe5ddc6..e4cc4741e291e4739ec3327af4411aeab5e44551 100644 --- a/arch/sw_64/configs/openeuler_defconfig +++ b/arch/sw_64/configs/openeuler_defconfig @@ -41,6 +41,7 @@ CONFIG_GENERIC_IRQ_LEGACY=y CONFIG_GENERIC_IRQ_PROBE=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_IRQ_MIGRATION=y +CONFIG_HARDIRQS_SW_RESEND=y CONFIG_GENERIC_IRQ_CHIP=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y @@ -99,13 +100,6 @@ CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13 # # Scheduler features # - -# -# Intelligent aware scheduler -# -# CONFIG_IAS_SMART_IDLE is not set -# CONFIG_IAS_SMART_LOAD_TRACKING is not set -# end of Intelligent aware scheduler # end of Scheduler features CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y @@ -116,9 +110,11 @@ CONFIG_PAGE_COUNTER=y CONFIG_MEMCG=y CONFIG_MEMCG_SWAP=y CONFIG_MEMCG_KMEM=y +# CONFIG_MEMCG_MEMFS_INFO is not set CONFIG_BLK_CGROUP=y CONFIG_CGROUP_WRITEBACK=y CONFIG_CGROUP_SCHED=y +# CONFIG_SCHED_PRIO_LB is not set CONFIG_FAIR_GROUP_SCHED=y # CONFIG_CFS_BANDWIDTH is not set # CONFIG_RT_GROUP_SCHED is not set @@ -214,6 +210,8 @@ CONFIG_SLAB_MERGE_DEFAULT=y # CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set CONFIG_SLUB_CPU_PARTIAL=y # CONFIG_PROFILING is not set +CONFIG_KABI_RESERVE=y +CONFIG_KABI_SIZE_ALIGN_CHECKS=y # end of General setup CONFIG_SW64=y @@ -225,6 +223,7 @@ CONFIG_SYS_SUPPORTS_HUGETLBFS=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y +CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_ZONE_DMA32=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y @@ -249,14 +248,19 @@ CONFIG_SW64_ASIC=y # CONFIG_SW64_CHIP3_ASIC_DEBUG is not set CONFIG_CPUFREQ_DEBUGFS=y CONFIG_PLATFORM_XUELANG=y +# CONFIG_MIGHT_HAVE_PC_SERIO is not set # end of Machine Configuration # CONFIG_LOCK_MEMB is not set -# CONFIG_DIRECT_DMA is not set -CONFIG_SWIOTLB=y + +# +# CPU Frequency scaling +# +# CONFIG_CPU_FREQ is not set +# end of CPU Frequency scaling + CONFIG_ISA=y CONFIG_ISA_DMA_API=y -CONFIG_PCI=y CONFIG_PCI_DOMAINS=y CONFIG_PCI_SYSCALL=y CONFIG_IOMMU_HELPER=y @@ -273,77 +277,11 @@ CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_NR_CPUS=64 CONFIG_HOTPLUG_CPU=y CONFIG_ARCH_SPARSEMEM_ENABLE=y -# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set CONFIG_NUMA=y CONFIG_USE_PERCPU_NUMA_NODE_ID=y CONFIG_NODES_SHIFT=7 # CONFIG_RELOCATABLE is not set CONFIG_HZ=100 -# CONFIG_PCIEPORTBUS is not set -CONFIG_PCIEASPM=y -CONFIG_PCIEASPM_DEFAULT=y -# CONFIG_PCIEASPM_POWERSAVE is not set -# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set -# CONFIG_PCIEASPM_PERFORMANCE is not set -# CONFIG_PCIE_PTM is not set -CONFIG_PCI_MSI=y -CONFIG_PCI_MSI_IRQ_DOMAIN=y -CONFIG_PCI_MSI_ARCH_FALLBACKS=y -CONFIG_PCI_QUIRKS=y -# CONFIG_PCI_DEBUG is not set -# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set -# CONFIG_PCI_STUB is not set -# CONFIG_PCI_PF_STUB is not set -CONFIG_PCI_ATS=y -CONFIG_PCI_IOV=y -# CONFIG_PCI_PRI is not set -# CONFIG_PCI_PASID is not set -CONFIG_PCI_LABEL=y -# CONFIG_PCIE_BUS_TUNE_OFF is not set -CONFIG_PCIE_BUS_DEFAULT=y -# CONFIG_PCIE_BUS_SAFE is not set -# CONFIG_PCIE_BUS_PERFORMANCE is not set -# CONFIG_PCIE_BUS_PEER2PEER is not set -# CONFIG_HOTPLUG_PCI is not set - -# -# PCI controller drivers -# -# CONFIG_PCI_FTPCI100 is not set -# CONFIG_PCI_HOST_GENERIC is not set -# CONFIG_PCIE_XILINX is not set - -# -# DesignWare PCI Core Support -# -# CONFIG_PCIE_DW_PLAT_HOST is not set -# CONFIG_PCI_MESON is not set -# end of DesignWare PCI Core Support - -# -# Mobiveil PCIe Core Support -# -# end of Mobiveil PCIe Core Support - -# -# Cadence PCIe controllers support -# -# CONFIG_PCIE_CADENCE_PLAT_HOST is not set -# CONFIG_PCI_J721E_HOST is not set -# end of Cadence PCIe controllers support -# end of PCI controller drivers - -# -# PCI Endpoint -# -# end of PCI Endpoint - -# -# PCI switch controller drivers -# -# CONFIG_PCI_SW_SWITCHTEC is not set -# end of PCI switch controller drivers - # CONFIG_PCCARD is not set # @@ -353,8 +291,6 @@ CONFIG_BINFMT_ELF=y CONFIG_ELFCORE=y # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set CONFIG_BINFMT_SCRIPT=y -CONFIG_HAVE_AOUT=y -# CONFIG_BINFMT_AOUT is not set # CONFIG_BINFMT_MISC is not set CONFIG_COREDUMP=y # end of Executable file formats @@ -373,7 +309,6 @@ CONFIG_DEEP_MEMSET=y # # Boot options # -CONFIG_SW64_IRQ_CHIP=y CONFIG_USE_OF=y # CONFIG_SW64_BUILTIN_DTB is not set CONFIG_EFI=y @@ -413,9 +348,18 @@ CONFIG_EFI_RUNTIME_WRAPPERS=y # # Power management options # -# CONFIG_SUSPEND is not set +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_SUSPEND_SKIP_SYNC is not set # CONFIG_HIBERNATION is not set -# CONFIG_PM is not set +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_WAKELOCKS is not set +CONFIG_PM=y +# CONFIG_PM_DEBUG is not set +CONFIG_PM_CLK=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set CONFIG_ARCH_SUPPORTS_ACPI=y CONFIG_ACPI=y # CONFIG_ACPI_DEBUGGER is not set @@ -424,6 +368,7 @@ CONFIG_ACPI=y CONFIG_ACPI_AC=y CONFIG_ACPI_BATTERY=y CONFIG_ACPI_BUTTON=y +CONFIG_ACPI_TAD=y # CONFIG_ACPI_DOCK is not set CONFIG_ACPI_CUSTOM_DSDT_FILE="" # CONFIG_ACPI_DEBUG is not set @@ -436,6 +381,9 @@ CONFIG_ACPI_REDUCED_HARDWARE_ONLY=y # CONFIG_PMIC_OPREGION is not set CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_SW64_SUSPEND_DEEPSLEEP_NONBOOT_CORE=y +CONFIG_SW64_SUSPEND_DEEPSLEEP_BOOTCORE=y +# CONFIG_SW64_SUPPORT_S3_SLEEPING_STATE is not set # # CPU Idle @@ -444,13 +392,13 @@ CONFIG_ARCH_HIBERNATION_POSSIBLE=y # end of CPU Idle # end of Power management options -CONFIG_DUMMY_CONSOLE=y CONFIG_HAVE_KVM_IRQCHIP=y CONFIG_HAVE_KVM_IRQFD=y CONFIG_HAVE_KVM_IRQ_ROUTING=y CONFIG_HAVE_KVM_EVENTFD=y CONFIG_HAVE_KVM_MSI=y CONFIG_KVM_VFIO=y +CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y CONFIG_VIRTUALIZATION=y CONFIG_KVM=y CONFIG_KVM_SW64_HOST=y @@ -473,8 +421,9 @@ CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_64BIT_ALIGNED_ACCESS=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_ARCH_TRACEHOOK=y CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_HAVE_ASM_MODVERSIONS=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y CONFIG_HAVE_PERF_REGS=y CONFIG_HAVE_PERF_USER_STACK_DUMP=y CONFIG_HAVE_ARCH_JUMP_LABEL=y @@ -491,7 +440,6 @@ CONFIG_MODULES_USE_ELF_RELA=y CONFIG_ARCH_HAS_ELF_RANDOMIZE=y CONFIG_ISA_BUS_API=y CONFIG_OLD_SIGSUSPEND=y -CONFIG_OLD_SIGACTION=y # CONFIG_COMPAT_32BIT_TIME is not set CONFIG_ARCH_NO_PREEMPT=y CONFIG_ARCH_HAS_PHYS_TO_DMA=y @@ -511,7 +459,6 @@ CONFIG_MODULE_FORCE_LOAD=y CONFIG_MODULE_UNLOAD=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MODVERSIONS=y -CONFIG_ASM_MODVERSIONS=y # CONFIG_MODULE_SRCVERSION_ALL is not set # CONFIG_MODULE_SIG is not set # CONFIG_MODULE_COMPRESS is not set @@ -564,6 +511,7 @@ CONFIG_EFI_PARTITION=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_MQ_VIRTIO=y CONFIG_BLK_MQ_RDMA=y +CONFIG_BLK_PM=y # # IO Schedulers @@ -665,7 +613,7 @@ CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y # CONFIG_TRANSPARENT_HUGEPAGE_MADVISE is not set # CONFIG_CLEANCACHE is not set # CONFIG_FRONTSWAP is not set -# CONFIG_SHRINK_PAGECACHE is not set +# CONFIG_PAGE_CACHE_LIMIT is not set CONFIG_CMA=y # CONFIG_CMA_DEBUG is not set # CONFIG_CMA_DEBUGFS is not set @@ -679,6 +627,7 @@ CONFIG_HMM_MIRROR=y # CONFIG_PERCPU_STATS is not set # CONFIG_GUP_BENCHMARK is not set # CONFIG_READ_ONLY_THP_FOR_FS is not set +CONFIG_ARCH_HAS_PTE_SPECIAL=y # # Data Access Monitoring @@ -775,7 +724,6 @@ CONFIG_DEFAULT_CUBIC=y # CONFIG_DEFAULT_RENO is not set CONFIG_DEFAULT_TCP_CONG="cubic" CONFIG_TCP_MD5SIG=y -# CONFIG_TCP_COMP is not set CONFIG_IPV6=m CONFIG_IPV6_ROUTER_PREF=y CONFIG_IPV6_ROUTE_INFO=y @@ -1318,14 +1266,48 @@ CONFIG_HAVE_EBPF_JIT=y # # Device Drivers # +CONFIG_HAVE_PCI=y +CONFIG_PCI=y +CONFIG_PCIEPORTBUS=y +CONFIG_PCIEAER=y +# CONFIG_PCIEAER_INJECT is not set +# CONFIG_PCIE_ECRC is not set +# CONFIG_PCIEASPM is not set +CONFIG_PCIE_PME=y +# CONFIG_PCIE_DPC is not set +# CONFIG_PCIE_PTM is not set +CONFIG_PCI_MSI=y +CONFIG_PCI_MSI_IRQ_DOMAIN=y +CONFIG_PCI_MSI_ARCH_FALLBACKS=y +CONFIG_PCI_QUIRKS=y +# CONFIG_PCI_DEBUG is not set +# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set +# CONFIG_PCI_STUB is not set +# CONFIG_PCI_PF_STUB is not set +CONFIG_PCI_ATS=y +CONFIG_PCI_IOV=y +# CONFIG_PCI_PRI is not set +# CONFIG_PCI_PASID is not set +CONFIG_PCI_LABEL=y +# CONFIG_PCIE_BUS_TUNE_OFF is not set +CONFIG_PCIE_BUS_DEFAULT=y +# CONFIG_PCIE_BUS_SAFE is not set +# CONFIG_PCIE_BUS_PERFORMANCE is not set +# CONFIG_PCIE_BUS_PEER2PEER is not set +# CONFIG_HOTPLUG_PCI is not set # # PCI controller drivers # +# CONFIG_PCI_FTPCI100 is not set +# CONFIG_PCI_HOST_GENERIC is not set +# CONFIG_PCIE_XILINX is not set # # DesignWare PCI Core Support # +# CONFIG_PCIE_DW_PLAT_HOST is not set +# CONFIG_PCI_MESON is not set # end of DesignWare PCI Core Support # @@ -1336,17 +1318,21 @@ CONFIG_HAVE_EBPF_JIT=y # # Cadence PCIe controllers support # +# CONFIG_PCIE_CADENCE_PLAT_HOST is not set +# CONFIG_PCI_J721E_HOST is not set # end of Cadence PCIe controllers support # end of PCI controller drivers # # PCI Endpoint # +# CONFIG_PCI_ENDPOINT is not set # end of PCI Endpoint # # PCI switch controller drivers # +# CONFIG_PCI_SW_SWITCHTEC is not set # end of PCI switch controller drivers # CONFIG_RAPIDIO is not set @@ -1368,6 +1354,7 @@ CONFIG_FW_LOADER=y CONFIG_EXTRA_FIRMWARE="" # CONFIG_FW_LOADER_USER_HELPER is not set # CONFIG_FW_LOADER_COMPRESS is not set +CONFIG_FW_CACHE=y # end of Firmware loader CONFIG_ALLOW_DEV_COREDUMP=y @@ -1375,6 +1362,8 @@ CONFIG_ALLOW_DEV_COREDUMP=y # CONFIG_DEBUG_DEVRES is not set # CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set # CONFIG_TEST_ASYNC_DRIVER_PROBE is not set +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y CONFIG_DMA_SHARED_BUFFER=y # CONFIG_DMA_FENCE_TRACE is not set # end of Generic Driver Options @@ -1383,6 +1372,7 @@ CONFIG_DMA_SHARED_BUFFER=y # Bus devices # # CONFIG_MOXTET is not set +# CONFIG_SIMPLE_PM_BUS is not set # CONFIG_MHI_BUS is not set # end of Bus devices @@ -1725,6 +1715,7 @@ CONFIG_PATA_TIMINGS=y CONFIG_ATA_VERBOSE_ERROR=y CONFIG_ATA_FORCE=y CONFIG_ATA_ACPI=y +# CONFIG_SATA_ZPODD is not set CONFIG_SATA_PMP=y # @@ -1988,7 +1979,6 @@ CONFIG_NET_VENDOR_QLOGIC=y # CONFIG_NETXEN_NIC is not set # CONFIG_QED is not set # CONFIG_NET_VENDOR_QUALCOMM is not set -CONFIG_NET_VENDOR_RAMAXEL=y CONFIG_NET_VENDOR_RDC=y # CONFIG_R6040 is not set CONFIG_NET_VENDOR_REALTEK=y @@ -2122,7 +2112,6 @@ CONFIG_USB_NET_DRIVERS=y # CONFIG_NETDEVSIM is not set CONFIG_NET_FAILOVER=y # CONFIG_ISDN is not set -# CONFIG_NVM is not set # # Input device support @@ -2182,8 +2171,6 @@ CONFIG_INPUT_KEYBOARD=y # Hardware I/O ports # CONFIG_SERIO=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -# CONFIG_SERIO_I8042 is not set # CONFIG_SERIO_SERPORT is not set # CONFIG_SERIO_PCIPS2 is not set CONFIG_SERIO_LIBPS2=y @@ -2204,6 +2191,7 @@ CONFIG_TTY=y CONFIG_VT=y CONFIG_CONSOLE_TRANSLATIONS=y CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y CONFIG_HW_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y CONFIG_UNIX98_PTYS=y @@ -2269,7 +2257,7 @@ CONFIG_VIRTIO_CONSOLE=y CONFIG_DEVMEM=y # CONFIG_DEVKMEM is not set # CONFIG_RAW_DRIVER is not set -CONFIG_DEVPORT=y +# CONFIG_DEVPORT is not set # CONFIG_TCG_TPM is not set # CONFIG_XILLYBUS is not set # end of Character devices @@ -2464,6 +2452,7 @@ CONFIG_HWMON=y # # Native drivers # +CONFIG_SENSORS_PVT=y # CONFIG_SENSORS_AD7314 is not set # CONFIG_SENSORS_AD7414 is not set # CONFIG_SENSORS_AD7418 is not set @@ -2532,7 +2521,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_LM63 is not set # CONFIG_SENSORS_LM70 is not set # CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set +CONFIG_SENSORS_LM75=y # CONFIG_SENSORS_LM77 is not set # CONFIG_SENSORS_LM78 is not set # CONFIG_SENSORS_LM80 is not set @@ -2643,6 +2632,7 @@ CONFIG_BCMA_POSSIBLE=y # CONFIG_LPC_SCH is not set # CONFIG_LPC_CHIP3 is not set # CONFIG_SUNWAY_SUPERIO_AST2400 is not set +# CONFIG_MFD_INTEL_PMT is not set # CONFIG_MFD_IQS62X is not set # CONFIG_MFD_JANZ_CMODIO is not set # CONFIG_MFD_KEMPLD is not set @@ -2938,9 +2928,11 @@ CONFIG_HDMI=y # # CONFIG_VGA_CONSOLE is not set # CONFIG_MDA_CONSOLE is not set +CONFIG_DUMMY_CONSOLE=y CONFIG_DUMMY_CONSOLE_COLUMNS=80 CONFIG_DUMMY_CONSOLE_ROWS=25 CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y # CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set @@ -3073,6 +3065,7 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_DEFAULT_PERSIST=y # CONFIG_USB_FEW_INIT_RETRIES is not set # CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_OTG is not set # CONFIG_USB_OTG_PRODUCTLIST is not set # CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set CONFIG_USB_AUTOSUSPEND_DELAY=2 @@ -3507,8 +3500,9 @@ CONFIG_SUNWAY_IOMMU=y # # IRQ chip support # -CONFIG_SW64_INTC=y CONFIG_IRQCHIP=y +CONFIG_SW64_INTC_V2=y +CONFIG_SW64_LPC_INTC=y # CONFIG_AL_FIC is not set # end of IRQ chip support @@ -3537,7 +3531,7 @@ CONFIG_IRQCHIP=y # # end of Performance monitor support -# CONFIG_RAS is not set +CONFIG_RAS=y # CONFIG_USB4 is not set # @@ -3546,6 +3540,11 @@ CONFIG_IRQCHIP=y # CONFIG_ANDROID is not set # end of Android +# +# Vendor Hooks +# +# end of Vendor Hooks + # CONFIG_LIBNVDIMM is not set # CONFIG_DAX is not set CONFIG_NVMEM=y @@ -3657,6 +3656,7 @@ CONFIG_FAT_DEFAULT_UTF8=y CONFIG_NTFS_FS=y # CONFIG_NTFS_DEBUG is not set CONFIG_NTFS_RW=y +# CONFIG_NTFS3_FS is not set # end of DOS/FAT/EXFAT/NT Filesystems # @@ -3675,6 +3675,7 @@ CONFIG_TMPFS_XATTR=y # CONFIG_TMPFS_INODE64 is not set CONFIG_HUGETLBFS=y CONFIG_HUGETLB_PAGE=y +# CONFIG_ENHANCED_HUGETLB_MMAP is not set CONFIG_MEMFD_CREATE=y CONFIG_CONFIGFS_FS=y CONFIG_EFIVAR_FS=m @@ -3935,7 +3936,7 @@ CONFIG_CRYPTO_SHA1=y CONFIG_CRYPTO_SHA256=y # CONFIG_CRYPTO_SHA512 is not set # CONFIG_CRYPTO_SHA3 is not set -# CONFIG_CRYPTO_SM3 is not set +# CONFIG_CRYPTO_SM3_GENERIC is not set # CONFIG_CRYPTO_STREEBOG is not set # CONFIG_CRYPTO_TGR192 is not set # CONFIG_CRYPTO_WP512 is not set @@ -3954,7 +3955,7 @@ CONFIG_CRYPTO_DES=y # CONFIG_CRYPTO_SALSA20 is not set # CONFIG_CRYPTO_CHACHA20 is not set # CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_SM4 is not set +# CONFIG_CRYPTO_SM4_GENERIC is not set # CONFIG_CRYPTO_TWOFISH is not set # @@ -4074,6 +4075,7 @@ CONFIG_HAS_DMA=y CONFIG_DMA_OPS=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y CONFIG_DMA_DECLARE_COHERENT=y +CONFIG_SWIOTLB=y # CONFIG_DMA_API_DEBUG is not set CONFIG_SGL_ALLOC=y CONFIG_CPU_RMAP=y @@ -4107,9 +4109,11 @@ CONFIG_SBITMAP=y CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 CONFIG_CONSOLE_LOGLEVEL_QUIET=7 CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set # CONFIG_DYNAMIC_DEBUG is not set # CONFIG_DYNAMIC_DEBUG_CORE is not set CONFIG_SYMBOLIC_ERRNAME=y +CONFIG_DEBUG_BUGVERBOSE=y # end of printk and dmesg options # @@ -4126,7 +4130,7 @@ CONFIG_FRAME_WARN=2048 CONFIG_SECTION_MISMATCH_WARN_ONLY=y # CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_32B is not set CONFIG_ARCH_WANT_FRAME_POINTERS=y -CONFIG_FRAME_POINTER=y +# CONFIG_FRAME_POINTER is not set # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set # end of Compile-time checks and compiler options @@ -4208,6 +4212,7 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_STACKTRACE=y # CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set # CONFIG_DEBUG_KOBJECT is not set +CONFIG_HAVE_DEBUG_BUGVERBOSE=y # # Debug kernel data structures @@ -4235,7 +4240,6 @@ CONFIG_RCU_CPU_STALL_TIMEOUT=21 # CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set # CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set -# CONFIG_LATENCYTOP is not set CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y CONFIG_HAVE_DYNAMIC_FTRACE=y @@ -4254,7 +4258,7 @@ CONFIG_EARLY_PRINTK=y CONFIG_MATHEMU=y CONFIG_STACKTRACE_SUPPORT=y # CONFIG_SW64_RRU is not set -# CONFIG_SW64_RRK is not set +CONFIG_SW64_RRK=y # end of sw_64 Debugging # @@ -4306,7 +4310,9 @@ CONFIG_RUNTIME_TESTING_MENU=y # CONFIG_TEST_FREE_PAGES is not set # CONFIG_MEMTEST is not set # end of Kernel Testing and Coverage -# end of Kernel hacking -CONFIG_KABI_SIZE_ALIGN_CHECKS=y -CONFIG_KABI_RESERVE=y +# +# Rust hacking +# +# end of Rust hacking +# end of Kernel hacking diff --git a/arch/sw_64/include/asm/asm-offsets.h b/arch/sw_64/include/asm/asm-offsets.h index 72cd408a9c6fa6594b8a17b19cf7d6b73b582f6c..5ddfd96ccb793c8d1011bc1542968d29e9a68416 100644 --- a/arch/sw_64/include/asm/asm-offsets.h +++ b/arch/sw_64/include/asm/asm-offsets.h @@ -4,4 +4,4 @@ #include -#endif +#endif /* _ASM_SW64_ASM_OFFSETS_H */ diff --git a/arch/sw_64/include/asm/asm-prototypes.h b/arch/sw_64/include/asm/asm-prototypes.h index 15bad8ef6883027ff7502a8e362e7b936dbc8d4b..67746d6bffb725b41d5997f983cded406e63573a 100644 --- a/arch/sw_64/include/asm/asm-prototypes.h +++ b/arch/sw_64/include/asm/asm-prototypes.h @@ -19,4 +19,4 @@ extern void __remlu(void); extern void __divwu(void); extern void __remwu(void); -#endif +#endif /* _ASM_SW64_ASM_PROTOTYPES_H */ diff --git a/arch/sw_64/include/asm/atomic.h b/arch/sw_64/include/asm/atomic.h index 126417a1aeeeccf51434d3d2b7d69664ee48d888..66f4437be103766dbf81dd0542f85f5c91b44d40 100644 --- a/arch/sw_64/include/asm/atomic.h +++ b/arch/sw_64/include/asm/atomic.h @@ -336,7 +336,7 @@ ATOMIC_OPS(sub) #define atomic64_fetch_add_relaxed atomic64_fetch_add_relaxed #define atomic64_fetch_sub_relaxed atomic64_fetch_sub_relaxed -#undef ATOMIC_OPS +#undef ATOMIC_OPS #define ATOMIC_OPS(op, asm) \ ATOMIC_OP(op, asm) \ diff --git a/arch/sw_64/include/asm/barrier.h b/arch/sw_64/include/asm/barrier.h index c691038919cd181345cd63e248afd48b6e4a233a..5f4a03d700c68f667c62c17b45983f907779a3f7 100644 --- a/arch/sw_64/include/asm/barrier.h +++ b/arch/sw_64/include/asm/barrier.h @@ -21,4 +21,4 @@ #include -#endif /* _ASM_SW64_BARRIER_H */ +#endif /* _ASM_SW64_BARRIER_H */ diff --git a/arch/sw_64/include/asm/bugs.h b/arch/sw_64/include/asm/bugs.h index c4a336fe04a2f66628e863aef87e9c5441c896c1..1cd94ed171fbc2c69523d87d37d19fecd37cc428 100644 --- a/arch/sw_64/include/asm/bugs.h +++ b/arch/sw_64/include/asm/bugs.h @@ -6,4 +6,4 @@ static void check_bugs(void) { } -#endif +#endif /* _ASM_SW64_BUGS_H */ diff --git a/arch/sw_64/include/asm/cache.h b/arch/sw_64/include/asm/cache.h index 1dca2e2e04a4360c28b2a68fdccd6eac011001b9..fade2e095b8b60a4e7c087018eff19fa769f84ae 100644 --- a/arch/sw_64/include/asm/cache.h +++ b/arch/sw_64/include/asm/cache.h @@ -8,4 +8,4 @@ #define L1_CACHE_SHIFT 7 #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) -#endif +#endif /* _ASM_SW64_CACHE_H */ diff --git a/arch/sw_64/include/asm/checksum.h b/arch/sw_64/include/asm/checksum.h index 284c1678f51ea084f71ee6a3747ce49854c512eb..7f3768290402bea31e0e5c445716012e81d6ad4e 100644 --- a/arch/sw_64/include/asm/checksum.h +++ b/arch/sw_64/include/asm/checksum.h @@ -123,4 +123,4 @@ static inline unsigned short from64to16(unsigned long x) return out_v.us[0] + out_v.us[1]; } -#endif +#endif /* _ASM_SW64_CHECKSUM_H */ diff --git a/arch/sw_64/include/asm/chip3_io.h b/arch/sw_64/include/asm/chip3_io.h index 14d02c080607403805e357207ec8fa1de9eb6376..18e79cf2a36ba9aac5bd7dff9f93e3af59025c1f 100644 --- a/arch/sw_64/include/asm/chip3_io.h +++ b/arch/sw_64/include/asm/chip3_io.h @@ -165,6 +165,9 @@ enum { MC_CAP_CFG = MCU_BASE | 0x1180UL, IO_START = MCU_BASE | 0x1300UL, UART_ONLINE = MCU_BASE | 0x1780UL, + I2C0_SRST_L = MCU_BASE | 0x1900UL, + I2C1_SRST_L = MCU_BASE | 0x1980UL, + I2C2_SRST_L = MCU_BASE | 0x1a00UL, MCU_DVC_INT = MCU_BASE | 0x3000UL, MCU_DVC_INT_EN = MCU_BASE | 0x3080UL, SI_FAULT_STAT = MCU_BASE | 0x3100UL, @@ -314,4 +317,4 @@ enum { GPIO_SWPORTA_DDR = GPIO_BASE | 0x200UL, }; /*--------------------------------------------------------------------------*/ -#endif +#endif /* _ASM_SW64_CHIP3_IO_H */ diff --git a/arch/sw_64/include/asm/clock.h b/arch/sw_64/include/asm/clock.h index 88714eb08507c6bdfd39326c6939e5610eb3421d..af6872ed9edbea4f6ab3f6b176bd0bc8398f9158 100644 --- a/arch/sw_64/include/asm/clock.h +++ b/arch/sw_64/include/asm/clock.h @@ -53,4 +53,4 @@ void sw64_update_clockevents(unsigned long cpu, u32 freq); void sw64_store_policy(struct cpufreq_policy *policy); unsigned int __sw64_cpufreq_get(struct cpufreq_policy *policy); -#endif /* _ASM_SW64_CLOCK_H */ +#endif /* _ASM_SW64_CLOCK_H */ diff --git a/arch/sw_64/include/asm/cmpxchg.h b/arch/sw_64/include/asm/cmpxchg.h index e07abc47c7dd2218862cb9df4a6c2f65b6d7d278..7f2d103db9c21c950825bc111bb0ee08b8d0e286 100644 --- a/arch/sw_64/include/asm/cmpxchg.h +++ b/arch/sw_64/include/asm/cmpxchg.h @@ -39,6 +39,7 @@ #endif #undef ____xchg #undef ____cmpxchg +#undef _ASM_SW64_XCHG_H #define ____xchg(type, args...) __xchg ##type(args) #define ____cmpxchg(type, args...) __cmpxchg ##type(args) #include diff --git a/arch/sw_64/include/asm/core.h b/arch/sw_64/include/asm/core.h index 72d752c8741261fa2a37caab52c1fb177d7925d5..e5e4cc138102791c5976634799afd60d646cc032 100644 --- a/arch/sw_64/include/asm/core.h +++ b/arch/sw_64/include/asm/core.h @@ -45,4 +45,4 @@ extern void entSys(void); extern void entUna(void); /* head.S */ extern void __smp_callin(unsigned long); -#endif +#endif /* _ASM_SW64_CORE_H */ diff --git a/arch/sw_64/include/asm/delay.h b/arch/sw_64/include/asm/delay.h index 45112c7c3c013b02b3d7a5368c9d29371e3af7b1..f4080753e9545c1f19cc3775b4ad362cc378b32f 100644 --- a/arch/sw_64/include/asm/delay.h +++ b/arch/sw_64/include/asm/delay.h @@ -8,4 +8,4 @@ extern void udelay(unsigned long usecs); extern void ndelay(unsigned long nsecs); #define ndelay ndelay -#endif /* defined(_ASM_SW64_DELAY_H) */ +#endif /* _ASM_SW64_DELAY_H */ diff --git a/arch/sw_64/include/asm/device.h b/arch/sw_64/include/asm/device.h index dadd756d693421ae5dc0e52d530cd293d88d4a75..bc1408c47dd3875bcb7b371411e876cb62ad93f2 100644 --- a/arch/sw_64/include/asm/device.h +++ b/arch/sw_64/include/asm/device.h @@ -10,4 +10,4 @@ struct dev_archdata { struct pdev_archdata { }; -#endif +#endif /* _ASM_SW64_DEVICE_H */ diff --git a/arch/sw_64/include/asm/dma-mapping.h b/arch/sw_64/include/asm/dma-mapping.h index bb84690eabfeeaef126c495567e3cbc395df06f3..37fce35b09d50d9a4a1b3e73456d2e97cbabd0de 100644 --- a/arch/sw_64/include/asm/dma-mapping.h +++ b/arch/sw_64/include/asm/dma-mapping.h @@ -9,4 +9,4 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) return dma_ops; } -#endif /* _ASM_SW64_DMA_MAPPING_H */ +#endif /* _ASM_SW64_DMA_MAPPING_H */ diff --git a/arch/sw_64/include/asm/dmi.h b/arch/sw_64/include/asm/dmi.h index 5142aa66ea45dfdd2710a0f40005fceca77ad6e7..05e80c9a3a76dc143e505440a41b7d150b873e3d 100644 --- a/arch/sw_64/include/asm/dmi.h +++ b/arch/sw_64/include/asm/dmi.h @@ -27,4 +27,4 @@ #define dmi_unmap(x) early_iounmap(x, 0) #define dmi_alloc(l) kzalloc(l, GFP_KERNEL) -#endif +#endif /* _ASM_SW64_DMI_H */ diff --git a/arch/sw_64/include/asm/early_ioremap.h b/arch/sw_64/include/asm/early_ioremap.h index 930c6bf36ad3c69a0be9dbe175649fc17d780d84..5459cba8a67772a1a4c904752272af13853eb02e 100644 --- a/arch/sw_64/include/asm/early_ioremap.h +++ b/arch/sw_64/include/asm/early_ioremap.h @@ -27,4 +27,4 @@ static inline void early_iounmap(volatile void __iomem *addr, unsigned long size } #define early_memunmap(addr, size) early_iounmap(addr, size) -#endif +#endif /* _ASM_SW64_EARLY_IOREMAP_H */ diff --git a/arch/sw_64/include/asm/efi.h b/arch/sw_64/include/asm/efi.h index 2bc863e3b8368be3d095495ed569c01383bb0f6b..f061cae2fc8a7f32c4c7445084b783ec662cddb3 100644 --- a/arch/sw_64/include/asm/efi.h +++ b/arch/sw_64/include/asm/efi.h @@ -21,7 +21,7 @@ extern void efi_init(void); __f(args); \ }) -#define ARCH_EFI_IRQ_FLAGS_MASK 0x00000001 +#define ARCH_EFI_IRQ_FLAGS_MASK 0x00000001 /* arch specific definitions used by the stub code */ diff --git a/arch/sw_64/include/asm/extable.h b/arch/sw_64/include/asm/extable.h index ae753772a45a9b12e8c4476b9e78be7921371822..3680b4a918a6676e8ce6b31fba2ef487dccfe9f4 100644 --- a/arch/sw_64/include/asm/extable.h +++ b/arch/sw_64/include/asm/extable.h @@ -56,4 +56,4 @@ struct exception_table_entry { extern short regoffsets[]; #define map_regs(r) (*(unsigned long *)((char *)regs + regoffsets[r])) -#endif +#endif /* _ASM_SW64_EXTABLE_H */ diff --git a/arch/sw_64/include/asm/hcall.h b/arch/sw_64/include/asm/hcall.h index b5438b477c87113db265f0fd7dd51b3a61f53bf4..65669e54c0f843927972f03753c0943240758895 100644 --- a/arch/sw_64/include/asm/hcall.h +++ b/arch/sw_64/include/asm/hcall.h @@ -39,4 +39,4 @@ static inline unsigned long hcall(unsigned long hcall, unsigned long arg0, return __r0; } -#endif /* _ASM_SW64_HCALL_H */ +#endif /* _ASM_SW64_HCALL_H */ diff --git a/arch/sw_64/include/asm/hmcall.h b/arch/sw_64/include/asm/hmcall.h index e85397ab06a1de2cee870f51b3506af577211f00..22de7d9f41a3af521800474b999d2f4599e6b978 100644 --- a/arch/sw_64/include/asm/hmcall.h +++ b/arch/sw_64/include/asm/hmcall.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_SW64_HMC_H -#define _ASM_SW64_HMC_H +#ifndef _ASM_SW64_HMCALL_H +#define _ASM_SW64_HMCALL_H /* * Common HMC-code @@ -12,12 +12,13 @@ #define HMC_cpuid 0x03 #define HMC_sleepen 0x05 #define HMC_rdksp 0x06 +#define HMC_wrasid 0x08 #define HMC_rdptbr 0x0B #define HMC_wrptbr 0x0C #define HMC_wrksp 0x0E #define HMC_mtinten 0x0F #define HMC_load_mm 0x11 -#define HMC_tbisasn 0x14 +#define HMC_tbisasid 0x14 #define HMC_tbivpn 0x19 #define HMC_ret 0x1A #define HMC_wrvpcr 0x29 @@ -55,16 +56,14 @@ extern void __init fixup_hmcall(void); extern void halt(void) __attribute__((noreturn)); -#define __halt() __asm__ __volatile__ ("sys_call %0 #halt" : : "i" (HMC_halt)) -#define fpu_enable() \ +#define __CALL_HMC_VOID(NAME) \ +static inline void NAME(void) \ { \ - __asm__ __volatile__("sys_call %0" : : "i" (HMC_wrfen));\ + __asm__ __volatile__( \ + "sys_call %0 ": : "i" (HMC_ ## NAME)); \ } -#define imb() \ - __asm__ __volatile__ ("sys_call %0 #imb" : : "i" (HMC_imb) : "memory") - #define __CALL_HMC_R0(NAME, TYPE) \ static inline TYPE NAME(void) \ { \ @@ -142,10 +141,14 @@ static inline RTYPE NAME(TYPE0 arg0, TYPE1 arg1, TYPE2 arg2) \ return __r0; \ } -#define sflush() \ -{ \ - __asm__ __volatile__("sys_call 0x2f"); \ -} + +__CALL_HMC_VOID(imb); +__CALL_HMC_VOID(sflush); +__CALL_HMC_VOID(wrfen); +#define fpu_enable() wrfen() + +__CALL_HMC_VOID(sleepen); +__CALL_HMC_VOID(mtinten); __CALL_HMC_R0(rdps, unsigned long); @@ -155,8 +158,15 @@ __CALL_HMC_W1(wrusp, unsigned long); __CALL_HMC_R0(rdksp, unsigned long); __CALL_HMC_W1(wrksp, unsigned long); +/* + * Load a mm context. This is needed when we change the page + * table pointer(CSR:PTBR) or when we update the ASID. + * load_mm(asid, ptbr) + * + */ __CALL_HMC_W2(load_mm, unsigned long, unsigned long); +__CALL_HMC_W1(wrasid, unsigned long); __CALL_HMC_R0(rdptbr, unsigned long); __CALL_HMC_W1(wrptbr, unsigned long); @@ -164,10 +174,8 @@ __CALL_HMC_RW1(swpipl, unsigned long, unsigned long); __CALL_HMC_R0(whami, unsigned long); __CALL_HMC_RW1(rdio64, unsigned long, unsigned long); __CALL_HMC_RW1(rdio32, unsigned int, unsigned long); -__CALL_HMC_R0(sleepen, unsigned long); -__CALL_HMC_R0(mtinten, unsigned long); __CALL_HMC_W2(wrent, void*, unsigned long); -__CALL_HMC_W2(tbisasn, unsigned long, unsigned long); +__CALL_HMC_W2(tbisasid, unsigned long, unsigned long); __CALL_HMC_W1(wrkgp, unsigned long); __CALL_HMC_RW2(wrperfmon, unsigned long, unsigned long, unsigned long); __CALL_HMC_RW3(sendii, unsigned long, unsigned long, unsigned long, unsigned long); @@ -216,4 +224,4 @@ __CALL_HMC_W1(wrtp, unsigned long); #endif /* !__ASSEMBLY__ */ #endif /* __KERNEL__ */ -#endif /* _ASM_SW64_HMC_H */ +#endif /* _ASM_SW64_HMCALL_H */ diff --git a/arch/sw_64/include/asm/hw_init.h b/arch/sw_64/include/asm/hw_init.h index 8a28aac2e54f05d83de77f69e030b7976d871a86..1fd7ed18c3f07e5177042eaaaa2a46ddfb97d9bf 100644 --- a/arch/sw_64/include/asm/hw_init.h +++ b/arch/sw_64/include/asm/hw_init.h @@ -18,7 +18,7 @@ struct cache_desc { }; struct cpuinfo_sw64 { - unsigned long last_asn; + unsigned long last_asid; unsigned long ipi_count; struct cache_desc icache; /* Primary I-cache */ struct cache_desc dcache; /* Primary D or combined I/D cache */ @@ -162,4 +162,4 @@ DECLARE_STATIC_KEY_FALSE(run_mode_emul_key); (((val) & CACHE_INDEX_BITS_MASK) >> CACHE_INDEX_BITS_SHIFT) #define current_cpu_data cpu_data[smp_processor_id()] -#endif /* HW_INIT_H */ +#endif /* _ASM_SW64_HW_INIT_H */ diff --git a/arch/sw_64/include/asm/hw_irq.h b/arch/sw_64/include/asm/hw_irq.h index f6fd1d802abdf9356ae94d59240036cc673b3fd0..ad5aed26efb7f9ca58bd3b5881e0858d401780c0 100644 --- a/arch/sw_64/include/asm/hw_irq.h +++ b/arch/sw_64/include/asm/hw_irq.h @@ -13,4 +13,4 @@ DECLARE_PER_CPU(unsigned long, irq_pmi_count); typedef unsigned int vector_irq_t[PERCPU_MSI_IRQS]; DECLARE_PER_CPU(vector_irq_t, vector_irq); #endif -#endif +#endif /* _ASM_SW64_HW_IRQ_H */ diff --git a/arch/sw_64/include/asm/insn.h b/arch/sw_64/include/asm/insn.h index 54a9a20267845d3a16785bbc5d5728856f2a3741..ec0efae3aed0320fafa9175c6155318309acc649 100644 --- a/arch/sw_64/include/asm/insn.h +++ b/arch/sw_64/include/asm/insn.h @@ -14,8 +14,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef _ASM_SW64_INSN_H -#define _ASM_SW64_INSN_H +#ifndef _ASM_SW64_INSN_H +#define _ASM_SW64_INSN_H #include /* Register numbers */ @@ -28,7 +28,7 @@ enum { #define BR_MAX_DISP 0xfffff /* SW64 instructions are always 32 bits. */ -#define SW64_INSN_SIZE 4 +#define SW64_INSN_SIZE 4 #define ___SW64_RA(a) (((a) & 0x1f) << 21) #define ___SW64_RB(b) (((b) & 0x1f) << 16) @@ -93,4 +93,4 @@ SW64_INSN(fbge, 0xf4000000, 0xfc000000); SW64_INSN(lldw, 0x20000000, 0xfc00f000); SW64_INSN(lldl, 0x20001000, 0xfc00f000); -#endif /* _ASM_SW64_INSN_H */ +#endif /* _ASM_SW64_INSN_H */ diff --git a/arch/sw_64/include/asm/irq_impl.h b/arch/sw_64/include/asm/irq_impl.h index 48dbc486a126d6b37cf10897ef2d9518e6302a75..797af433a1267c8b49cfda9901baed051ff16b98 100644 --- a/arch/sw_64/include/asm/irq_impl.h +++ b/arch/sw_64/include/asm/irq_impl.h @@ -45,4 +45,4 @@ extern void handle_ipi(struct pt_regs *regs); extern void __init sw64_init_irq(void); extern irqreturn_t timer_interrupt(int irq, void *dev); -#endif +#endif /* _ASM_SW64_IRQ_IMPL_H */ diff --git a/arch/sw_64/include/asm/jump_label.h b/arch/sw_64/include/asm/jump_label.h index 78d3fb6246f013862df71773d497281f7f82a226..32fbf7573b206bb2c935cc173de392b100d02010 100644 --- a/arch/sw_64/include/asm/jump_label.h +++ b/arch/sw_64/include/asm/jump_label.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_SW64_JUMP_LABEL_H -#define __ASM_SW64_JUMP_LABEL_H +#ifndef _ASM_SW64_JUMP_LABEL_H +#define _ASM_SW64_JUMP_LABEL_H #ifndef __ASSEMBLY__ @@ -47,4 +47,4 @@ struct jump_entry { }; #endif /* __ASSEMBLY__ */ -#endif /* __ASM_SW64_JUMP_LABEL_H */ +#endif /* _ASM_SW64_JUMP_LABEL_H */ diff --git a/arch/sw_64/include/asm/kgdb.h b/arch/sw_64/include/asm/kgdb.h index 1d807362e867ce089bf2f7d78026a68b5abc3ac7..6478c7a989c37a92846dcb9ea9161ab218a31894 100644 --- a/arch/sw_64/include/asm/kgdb.h +++ b/arch/sw_64/include/asm/kgdb.h @@ -34,7 +34,7 @@ static inline void arch_kgdb_breakpoint(void) { - asm __volatile__ ("sys_call/b 0x80"); + asm __volatile__ ("sys_call %0" : : "i"(HMC_bpt) ); } void sw64_task_to_gdb_regs(struct task_struct *task, unsigned long *regs); diff --git a/arch/sw_64/include/asm/kprobes.h b/arch/sw_64/include/asm/kprobes.h index c19b961a19da4143e419c4bef5de399ef7d2e086..6b7e4548a8bd365f17d73bcd468e25e872b56c0e 100644 --- a/arch/sw_64/include/asm/kprobes.h +++ b/arch/sw_64/include/asm/kprobes.h @@ -19,7 +19,7 @@ #include #include -#define __ARCH_WANT_KPROBES_INSN_SLOT +#define __ARCH_WANT_KPROBES_INSN_SLOT struct kprobe; struct pt_regs; diff --git a/arch/sw_64/include/asm/kvm_asm.h b/arch/sw_64/include/asm/kvm_asm.h index 7e2c92ed45749d0defdb2771d98a6e431bfbb0f3..841bfa1dd0aad0c4ac99365b856e9b5f5eda0440 100644 --- a/arch/sw_64/include/asm/kvm_asm.h +++ b/arch/sw_64/include/asm/kvm_asm.h @@ -4,6 +4,8 @@ #define SW64_KVM_EXIT_HOST_INTR 0 #define SW64_KVM_EXIT_IO 1 +#define SW64_KVM_MIGRATION_SET_DIRTY 2 +#define SW64_KVM_MIGRATION_SET_DIRTY_HM 3 #define SW64_KVM_EXIT_HALT 10 #define SW64_KVM_EXIT_SHUTDOWN 12 #define SW64_KVM_EXIT_TIMER 13 @@ -14,4 +16,16 @@ #ifdef CONFIG_KVM_MEMHOTPLUG #define SW64_KVM_EXIT_MEMHOTPLUG 23 #endif + +#define kvm_sw64_exception_type \ + {0, "HOST_INTR" }, \ + {1, "IO" }, \ + {10, "HALT" }, \ + {12, "SHUTDOWN" }, \ + {13, "TIMER" }, \ + {14, "IPI" }, \ + {17, "RESTART" }, \ + {22, "FATAL_ERROR" }, \ + {23, "MEMHOTPLUG" } + #endif /* _ASM_SW64_KVM_ASM_H */ diff --git a/arch/sw_64/include/asm/kvm_cma.h b/arch/sw_64/include/asm/kvm_cma.h index 192bca43638089cef0c0e0d0ee6e1126231fb596..d50ba599ceb716ac0309122cf77c1e2ea38c70d7 100644 --- a/arch/sw_64/include/asm/kvm_cma.h +++ b/arch/sw_64/include/asm/kvm_cma.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_SW64_KVM_CMA_H__ -#define _ASM_SW64_KVM_CMA_H__ +#ifndef _ASM_SW64_KVM_CMA_H +#define _ASM_SW64_KVM_CMA_H #include @@ -8,4 +8,4 @@ extern int __init kvm_cma_declare_contiguous(phys_addr_t base, phys_addr_t size, phys_addr_t limit, phys_addr_t alignment, unsigned int order_per_bit, const char *name, struct cma **res_cma); -#endif +#endif /* _ASM_SW64_KVM_CMA_H */ diff --git a/arch/sw_64/include/asm/kvm_emulate.h b/arch/sw_64/include/asm/kvm_emulate.h index d842008f189a326e497cd38d940a59f3d5e9c8f3..915aa6c0bce212b8b06bb3aa19aa6aee8c04e532 100644 --- a/arch/sw_64/include/asm/kvm_emulate.h +++ b/arch/sw_64/include/asm/kvm_emulate.h @@ -43,4 +43,4 @@ unsigned int interrupt_pending(struct kvm_vcpu *vcpu, bool *more); void clear_vcpu_irq(struct kvm_vcpu *vcpu); void inject_vcpu_irq(struct kvm_vcpu *vcpu, unsigned int irq); void try_deliver_interrupt(struct kvm_vcpu *vcpu, unsigned int irq, bool more); -#endif +#endif /* _ASM_SW64_KVM_EMULATE_H */ diff --git a/arch/sw_64/include/asm/kvm_host.h b/arch/sw_64/include/asm/kvm_host.h index 6d292c0863478e6d2bef2d293280fe9ec4aa3cbe..02d7131f02865c5f2b832ee5db5be6aec8e13fed 100644 --- a/arch/sw_64/include/asm/kvm_host.h +++ b/arch/sw_64/include/asm/kvm_host.h @@ -124,4 +124,7 @@ static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) {} static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) {} static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {} -#endif /* _ASM_SW64_KVM_HOST_H */ +int kvm_sw64_perf_init(void); +int kvm_sw64_perf_teardown(void); + +#endif /* _ASM_SW64_KVM_HOST_H */ diff --git a/arch/sw_64/include/asm/kvm_mmio.h b/arch/sw_64/include/asm/kvm_mmio.h index 9ba31c91902fd2e16be4a7f379d21c2c2358cd11..c87b259e9395f0943b062c4d4a6e08a433bacf1d 100644 --- a/arch/sw_64/include/asm/kvm_mmio.h +++ b/arch/sw_64/include/asm/kvm_mmio.h @@ -14,4 +14,4 @@ int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run); int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run, struct hcall_args *hargs); -#endif /* _ASM_SW64_KVM_MMIO_H */ +#endif /* _ASM_SW64_KVM_MMIO_H */ diff --git a/arch/sw_64/include/asm/kvm_para.h b/arch/sw_64/include/asm/kvm_para.h index ba78c53715701b8a3f59ebc11631e1e6d648fa1d..442f1c7d9f832159bcb04068b8939c1fa3b107cc 100644 --- a/arch/sw_64/include/asm/kvm_para.h +++ b/arch/sw_64/include/asm/kvm_para.h @@ -23,4 +23,4 @@ static inline unsigned long kvm_hypercall3(unsigned long num, : "$1", "$22", "$23", "$24", "$25"); return __r0; } -#endif +#endif /* _ASM_SW64_KVM_PARA_H */ diff --git a/arch/sw_64/include/asm/kvm_timer.h b/arch/sw_64/include/asm/kvm_timer.h index be50bba9c4c684d11c13faccd9c03c176d930825..8080873c684f82b0e0c06b7e55c72ba475f497cd 100644 --- a/arch/sw_64/include/asm/kvm_timer.h +++ b/arch/sw_64/include/asm/kvm_timer.h @@ -6,4 +6,4 @@ void set_timer(struct kvm_vcpu *vcpu, unsigned long delta); void set_interrupt(struct kvm_vcpu *vcpu, unsigned int irq); enum hrtimer_restart clockdev_fn(struct hrtimer *timer); -#endif +#endif /* _ASM_SW64_KVM_TIMER_H */ diff --git a/arch/sw_64/include/asm/linkage.h b/arch/sw_64/include/asm/linkage.h index 96c83663d9e84b81a03a1673a4e02284136e3826..6576fb46a000c3c6e7a6cfb644db9db8b981a959 100644 --- a/arch/sw_64/include/asm/linkage.h +++ b/arch/sw_64/include/asm/linkage.h @@ -6,4 +6,4 @@ #define SYSCALL_ALIAS(alias, name) \ asm(#alias " = " #name "\n\t.globl " #alias) -#endif +#endif /* _ASM_SW64_LINKAGE_H */ diff --git a/arch/sw_64/include/asm/mmu.h b/arch/sw_64/include/asm/mmu.h index 548c73b318cb2acbeeaa501bbabc9d95c4151b9c..f24219fac654bb3381ea0e85e5faeeb3486d23d3 100644 --- a/arch/sw_64/include/asm/mmu.h +++ b/arch/sw_64/include/asm/mmu.h @@ -7,4 +7,4 @@ typedef struct { unsigned long asid[NR_CPUS]; void *vdso; } mm_context_t; -#endif +#endif /* _ASM_SW64_MMU_H */ diff --git a/arch/sw_64/include/asm/mmu_context.h b/arch/sw_64/include/asm/mmu_context.h index 84e84048a3ba6527941b1b1271c1fdcafdddda3a..5ae9d4616937f7f3f22bfeb79fe394a9409f6ef2 100644 --- a/arch/sw_64/include/asm/mmu_context.h +++ b/arch/sw_64/include/asm/mmu_context.h @@ -2,95 +2,73 @@ #ifndef _ASM_SW64_MMU_CONTEXT_H #define _ASM_SW64_MMU_CONTEXT_H -/* - * get a new mmu context.. - * - * Copyright (C) 1996, Linus Torvalds - */ #include #include #include /* - * Load a mm context. This is needed when we change the page - * table pointer(CSR:PTBR) or when we update the ASID. - * - */ -#define load_asn_ptbr load_mm - -/* - * The maximum ASN's the processor supports. ASN is called ASID too. + * The maximum ASID's the processor supports. */ #ifdef CONFIG_SUBARCH_C3B -#define WIDTH_HARDWARE_ASN 10 +#define ASID_BITS 10 #endif -/* - * cpu_last_asn(processor): - * 63 0 - * +-------------+----------------+--------------+ - * | asn version | this processor | hardware asn | - * +-------------+----------------+--------------+ - */ - #include -#define cpu_last_asn(cpuid) (cpu_data[cpuid].last_asn) +#define last_asid(cpu) (cpu_data[cpu].last_asid) -#define ASN_FIRST_VERSION (1UL << WIDTH_HARDWARE_ASN) -#define HARDWARE_ASN_MASK ((1UL << WIDTH_HARDWARE_ASN) - 1) +#define ASID_FIRST_VERSION (1UL << ASID_BITS) +#define ASID_MASK ((1UL << ASID_BITS) - 1) + +#define cpu_asid(cpu, mm) ((mm)->context.asid[cpu] & ASID_MASK) + +static inline bool asid_valid(struct mm_struct *mm, unsigned int cpu) +{ + return !((mm->context.asid[cpu] ^ last_asid(cpu)) & ~ASID_MASK); +} /* - * NOTE! The way this is set up, the high bits of the "asn_cache" (and - * the "mm->context") are the ASN _version_ code. A version of 0 is - * always considered invalid, so to invalidate another process you only - * need to do "p->mm->context = 0". + * NOTE! The way this is set up, the high bits of the "last_asid" (and + * the "mm->context.asid[cpu]") are the ASID _version_ code. A version + * of 0 is always considered invalid, so to invalidate another process + * you only need to do "p->mm->context.asid[cpu] = 0". * - * If we need more ASN's than the processor has, we invalidate the old - * user TLB's (tbivp()) and start a new ASN version. That will automatically - * force a new asn for any other processes the next time they want to - * run. + * If we need more ASID's than the processor has, we invalidate the old + * user TLB's (tbivp()) and start a new ASID version. That will force a + * new asid for any other processes the next time they want to run. */ -static inline unsigned long -__get_new_mm_context(struct mm_struct *mm, long cpu) +static inline void __get_new_mm_context(struct mm_struct *mm, long cpu) { - unsigned long asn = cpu_last_asn(cpu); - unsigned long next = asn + 1; + unsigned long asid = last_asid(cpu); - if ((asn & HARDWARE_ASN_MASK) >= HARDWARE_ASN_MASK) { + if (!(++asid & ASID_MASK)) tbivp(); - next = (asn & ~HARDWARE_ASN_MASK) + ASN_FIRST_VERSION; - } - cpu_last_asn(cpu) = next; - return next; + mm->context.asid[cpu] = last_asid(cpu) = asid; + } static inline void switch_mm_irqs_off(struct mm_struct *prev_mm, struct mm_struct *next_mm, struct task_struct *next) { - /* Check if our ASN is of an older version, and thus invalid. */ - unsigned long asn, mmc, ptbr; + /* Check if our ASID is of an older version, and thus invalid. */ + unsigned long asid, ptbr; long cpu = smp_processor_id(); - asn = cpu_last_asn(cpu); - mmc = next_mm->context.asid[cpu]; - if ((mmc ^ asn) & ~HARDWARE_ASN_MASK) { - /* Check if mmc and cpu asn is in the same version */ - mmc = __get_new_mm_context(next_mm, cpu); - next_mm->context.asid[cpu] = mmc; - } + if (!asid_valid(next_mm, cpu)) + __get_new_mm_context(next_mm, cpu); /* * Update CSR:UPN and CSR:PTBR. Another thread may have allocated - * a new mm->context[asid] (via flush_tlb_mm) without the ASN serial + * a new mm->context[asid] (via flush_tlb_mm) without the ASID serial * number wrapping. We have no way to detect when this is needed. */ - asn = mmc & HARDWARE_ASN_MASK; + asid = cpu_asid(cpu, next_mm); ptbr = virt_to_pfn(next_mm->pgd); - load_asn_ptbr(asn, ptbr); + load_mm(asid, ptbr); + cpumask_set_cpu(cpu, mm_cpumask(next_mm)); } #define switch_mm_irqs_off switch_mm_irqs_off diff --git a/arch/sw_64/include/asm/msi.h b/arch/sw_64/include/asm/msi.h index 079fac0d128e9100fed22456cef93d6a951ba8b9..ca5850eb5957eb45014c8b3edd4422b5fc2fe4a5 100644 --- a/arch/sw_64/include/asm/msi.h +++ b/arch/sw_64/include/asm/msi.h @@ -42,6 +42,6 @@ struct irq_alloc_info { irq_hw_number_t hwirq; }; typedef struct irq_alloc_info msi_alloc_info_t; -#endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */ -#endif /* CONFIG_PCI_MSI */ -#endif /* _ASM_SW64_MSI_H */ +#endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */ +#endif /* CONFIG_PCI_MSI */ +#endif /* _ASM_SW64_MSI_H */ diff --git a/arch/sw_64/include/asm/numa.h b/arch/sw_64/include/asm/numa.h index 4ea8b8de248af170f1cc9107e20d078f17a29f37..930be783181308e688e6746a9d8cab86ee6e6806 100644 --- a/arch/sw_64/include/asm/numa.h +++ b/arch/sw_64/include/asm/numa.h @@ -30,6 +30,6 @@ static inline void set_cpuid_to_node(int cpuid, s16 node) __cpuid_to_node[cpuid] = node; } -#endif /* CONFIG_NUMA */ +#endif /* CONFIG_NUMA */ -#endif /* _ASM_SW64_NUMA_H */ +#endif /* _ASM_SW64_NUMA_H */ diff --git a/arch/sw_64/include/asm/pci.h b/arch/sw_64/include/asm/pci.h index a90f80152470911af9b6c3d2080fb0c3956982ea..ab79d503b84daff89f18ca06771bcc8893f96b0c 100644 --- a/arch/sw_64/include/asm/pci.h +++ b/arch/sw_64/include/asm/pci.h @@ -18,6 +18,13 @@ struct resource; struct sunway_iommu; struct page; +struct piu_saved { + unsigned long piuconfig0; + unsigned long piuconfig1; + unsigned long epdmabar; + unsigned long msiaddr; + unsigned long msiconfig[256]; +}; /* A controller. Used to manage multiple PCI busses. */ diff --git a/arch/sw_64/include/asm/perf_event.h b/arch/sw_64/include/asm/perf_event.h index 5f5a45217544f57b2d8da3b0df56174d0587669a..4212342334d5d12926166235e69ee02806aea694 100644 --- a/arch/sw_64/include/asm/perf_event.h +++ b/arch/sw_64/include/asm/perf_event.h @@ -3,5 +3,13 @@ #define _ASM_SW64_PERF_EVENT_H #include +#include + +#ifdef CONFIG_PERF_EVENTS +struct pt_regs; +extern unsigned long perf_instruction_pointer(struct pt_regs *regs); +extern unsigned long perf_misc_flags(struct pt_regs *regs); +#define perf_misc_flags(regs) perf_misc_flags(regs) +#endif #endif /* _ASM_SW64_PERF_EVENT_H */ diff --git a/arch/sw_64/include/asm/pgtable-4level.h b/arch/sw_64/include/asm/pgtable-4level.h index 8c45f441c52082673cc81c6f763ce8c17ff42695..719e2c5377e349b8765a947a57f273835f2dc52b 100644 --- a/arch/sw_64/include/asm/pgtable-4level.h +++ b/arch/sw_64/include/asm/pgtable-4level.h @@ -2,7 +2,7 @@ #ifndef _ASM_SW64_PGTABLE_4LEVEL_H #define _ASM_SW64_PGTABLE_4LEVEL_H -#ifdef __KERNEL__ +#ifdef __KERNEL__ #ifndef __ASSEMBLY__ /* * These are used to make use of C type-checking.. diff --git a/arch/sw_64/include/asm/pgtable.h b/arch/sw_64/include/asm/pgtable.h index 76c782baf242bd6bdf40c682b5b95b693f4e94a4..b451bc94e7377b7cca2770abb2f3d840cf230a37 100644 --- a/arch/sw_64/include/asm/pgtable.h +++ b/arch/sw_64/include/asm/pgtable.h @@ -544,7 +544,7 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm, #define mk_pmd(page, prot) pfn_pmd(page_to_pfn(page), (prot)) -#define __HAVE_ARCH_PMDP_SET_ACCESS_FLAGS +#define __HAVE_ARCH_PMDP_SET_ACCESS_FLAGS extern int pmdp_set_access_flags(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp, pmd_t entry, int dirty); diff --git a/arch/sw_64/include/asm/platform.h b/arch/sw_64/include/asm/platform.h index 318b6ca732cd6bfa8d468b59f0764a877059f965..59418bba9de7c6f86207d7ac6cf3e9c93652e38b 100644 --- a/arch/sw_64/include/asm/platform.h +++ b/arch/sw_64/include/asm/platform.h @@ -14,4 +14,4 @@ extern struct sw64_platform_ops *sw64_platform; extern struct sw64_platform_ops xuelang_ops; -#endif /* _ASM_SW64_PLATFORM_H */ +#endif /* _ASM_SW64_PLATFORM_H */ diff --git a/arch/sw_64/include/asm/ptrace.h b/arch/sw_64/include/asm/ptrace.h index b5afebf82939c0dc94d0b984d53dcb616c2b6a92..5f6cd305f95e6c3fa1c2801e52903eb4a438d470 100644 --- a/arch/sw_64/include/asm/ptrace.h +++ b/arch/sw_64/include/asm/ptrace.h @@ -92,4 +92,4 @@ static inline unsigned long regs_return_value(struct pt_regs *regs) { return regs->r0; } -#endif +#endif /* _ASM_SW64_PTRACE_H */ diff --git a/arch/sw_64/include/asm/setup.h b/arch/sw_64/include/asm/setup.h index c0fb4e8bd80c40ce9f43d6f951bfc349bc62b7a0..384eeba021446347359d097528f205606e1a4334 100644 --- a/arch/sw_64/include/asm/setup.h +++ b/arch/sw_64/include/asm/setup.h @@ -43,4 +43,4 @@ extern struct boot_params *sunway_boot_params; #endif -#endif +#endif /* _ASM_SW64_SETUP_H */ diff --git a/arch/sw_64/include/asm/sfp-machine.h b/arch/sw_64/include/asm/sfp-machine.h index 9b3e8688feee7725e76e51d75d34106be638d86d..c1b914898543d01498834bd1d8dff4215fee768c 100644 --- a/arch/sw_64/include/asm/sfp-machine.h +++ b/arch/sw_64/include/asm/sfp-machine.h @@ -66,4 +66,4 @@ do { \ /* We write the results always */ #define FP_INHIBIT_RESULTS 0 -#endif +#endif /* _ASM_SW64_SFP_MACHINE_H */ diff --git a/arch/sw_64/include/asm/signal.h b/arch/sw_64/include/asm/signal.h index 0d846c1aa571e5ea946d7ef9422ba63d77d3bd30..9e0936e6db2b4265320d46a606a7bd04c91f0f8b 100644 --- a/arch/sw_64/include/asm/signal.h +++ b/arch/sw_64/include/asm/signal.h @@ -21,4 +21,4 @@ struct odd_sigaction { }; #include -#endif +#endif /* _ASM_SW64_SIGNAL_H */ diff --git a/arch/sw_64/include/asm/smp.h b/arch/sw_64/include/asm/smp.h index e7aa742f73f0dd95b77e4c0a26e56c93f7311665..0573361dc840d021f3acf88989e4eeae2ce5be97 100644 --- a/arch/sw_64/include/asm/smp.h +++ b/arch/sw_64/include/asm/smp.h @@ -178,4 +178,4 @@ static inline void send_ipi(int cpu, unsigned long type) #define reset_cpu(cpu) send_ipi((cpu), II_RESET) -#endif +#endif /* _ASM_SW64_SMP_H */ diff --git a/arch/sw_64/include/asm/spinlock_types.h b/arch/sw_64/include/asm/spinlock_types.h index 28f2183ced749485f0bbbdff5767bf081c943430..62e554e4f48c35b2d4578072231b58c75b202a4b 100644 --- a/arch/sw_64/include/asm/spinlock_types.h +++ b/arch/sw_64/include/asm/spinlock_types.h @@ -5,4 +5,4 @@ #include #include -#endif +#endif /* _ASM_SW64_SPINLOCK_TYPES_H */ diff --git a/arch/sw_64/include/asm/stacktrace.h b/arch/sw_64/include/asm/stacktrace.h index ed691a72573bd210be25f8c372324a0d2c076b1f..958c9892fd6d0943bf78484c7e870323694fbde8 100644 --- a/arch/sw_64/include/asm/stacktrace.h +++ b/arch/sw_64/include/asm/stacktrace.h @@ -69,4 +69,4 @@ static inline bool on_accessible_stack(struct task_struct *tsk, return false; } -#endif /* _ASM_SW64_STACKTRACE_H */ +#endif /* _ASM_SW64_STACKTRACE_H */ diff --git a/arch/sw_64/include/asm/suspend.h b/arch/sw_64/include/asm/suspend.h index de6d97a0aff6d88956a90dc6bb57cb27c3dbaf26..521ab099f94b80ca6f31abc0f5da5447a6debeb0 100644 --- a/arch/sw_64/include/asm/suspend.h +++ b/arch/sw_64/include/asm/suspend.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_SW64_SLEEP_H -#define _ASM_SW64_SLEEP_H +#ifndef _ASM_SW64_SUSPEND_H +#define _ASM_SW64_SUSPEND_H #include #include @@ -45,4 +45,4 @@ struct processor_state { }; extern void sw64_suspend_deep_sleep(struct processor_state *state); -#endif /* _ASM_SW64_SLEEP_H */ +#endif /* _ASM_SW64_SUSPEND_H */ diff --git a/arch/sw_64/include/asm/sw64_init.h b/arch/sw_64/include/asm/sw64_init.h index 2d9140605d0b041694cb5c359656c9e8e9735125..893bac1c621b499d0fabeb495097616606d34fae 100644 --- a/arch/sw_64/include/asm/sw64_init.h +++ b/arch/sw_64/include/asm/sw64_init.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_SW64_INIT_H -#define _ASM_SW64_INIT_H +#ifndef _ASM_SW64_SW64_INIT_H +#define _ASM_SW64_SW64_INIT_H #include #include @@ -32,7 +32,7 @@ struct sw64_chip_init_ops { struct sw64_chip_ops { int (*get_cpu_num)(void); void (*device_interrupt)(unsigned long irq_info); - void (*suspend)(int wake); + void (*suspend)(bool wake); void (*fixup)(void); }; @@ -43,4 +43,4 @@ extern struct sw64_chip_init_ops *sw64_chip_init; DECLARE_PER_CPU(unsigned long, hard_node_id); -#endif /* _ASM_SW64_INIT_H */ +#endif /* _ASM_SW64_SW64_INIT_H */ diff --git a/arch/sw_64/include/asm/sw64io.h b/arch/sw_64/include/asm/sw64io.h index 7d79a5b75090d82b2df8cde97918405cc4dcbb3c..0892356b8e6b7ad6cca0d81906afbcd48a24df33 100644 --- a/arch/sw_64/include/asm/sw64io.h +++ b/arch/sw_64/include/asm/sw64io.h @@ -95,4 +95,4 @@ sw64_io_write(unsigned long node, unsigned long reg, unsigned long data) addr = __va(SW64_IO_BASE(node) | reg); writeq(data, addr); } -#endif +#endif /* _ASM_SW64_SW64IO_H */ diff --git a/arch/sw_64/include/asm/syscall.h b/arch/sw_64/include/asm/syscall.h index 4b784c3d846b562e98c1af22e4fde90380169854..0b1556a460b463ab5962ce7368768fdfcf8a510e 100644 --- a/arch/sw_64/include/asm/syscall.h +++ b/arch/sw_64/include/asm/syscall.h @@ -72,4 +72,4 @@ static inline int syscall_get_arch(struct task_struct *task) return AUDIT_ARCH_SW64; } -#endif /* _ASM_SW64_SYSCALL_H */ +#endif /* _ASM_SW64_SYSCALL_H */ diff --git a/arch/sw_64/include/asm/tc.h b/arch/sw_64/include/asm/tc.h index f995a2a75f8550afde45213b51e785d16963a073..aa39c3528e3fa923022365c1db31c1ef2c61e220 100644 --- a/arch/sw_64/include/asm/tc.h +++ b/arch/sw_64/include/asm/tc.h @@ -13,4 +13,4 @@ static inline unsigned long rdtc(void) extern void tc_sync_clear(void); extern void tc_sync_ready(void *ignored); extern void tc_sync_set(void); -#endif +#endif /* _ASM_SW64_TC_H */ diff --git a/arch/sw_64/include/asm/termios.h b/arch/sw_64/include/asm/termios.h index ef509946675a1f46e53284b272f6a652ded543e3..9849dd9b58bf60ff09edd0b11810de31b6a13223 100644 --- a/arch/sw_64/include/asm/termios.h +++ b/arch/sw_64/include/asm/termios.h @@ -78,4 +78,4 @@ #define kernel_termios_to_user_termios(u, k) \ copy_to_user(u, k, sizeof(struct termios)) -#endif /* _ASM_SW64_TERMIOS_H */ +#endif /* _ASM_SW64_TERMIOS_H */ diff --git a/arch/sw_64/include/asm/timex.h b/arch/sw_64/include/asm/timex.h index 9065e39a0466cff54233f124bc34a053d9b8df3f..235197b0d1fd825713acafa7b5e3dc1a1ba25062 100644 --- a/arch/sw_64/include/asm/timex.h +++ b/arch/sw_64/include/asm/timex.h @@ -21,4 +21,4 @@ static inline cycles_t get_cycles(void) return rdtc(); } -#endif +#endif /* _ASM_SW64_TIMEX_H */ diff --git a/arch/sw_64/include/asm/tlb.h b/arch/sw_64/include/asm/tlb.h index 4902624dba888d81d0c3ba6d036eb977218d544b..67ce55fc4c43cbade95cf356b317061bb0cb34db 100644 --- a/arch/sw_64/include/asm/tlb.h +++ b/arch/sw_64/include/asm/tlb.h @@ -15,4 +15,4 @@ #define __pud_free_tlb(tlb, pud, address) pud_free((tlb)->mm, pud) -#endif +#endif /* _ASM_SW64_TLB_H */ diff --git a/arch/sw_64/include/asm/tlbflush.h b/arch/sw_64/include/asm/tlbflush.h index b35af83e6ec271f27819b2f4a5c29ea13d16d0bf..53c384932eb99cd0f1e2cc3b4b03281edc548936 100644 --- a/arch/sw_64/include/asm/tlbflush.h +++ b/arch/sw_64/include/asm/tlbflush.h @@ -10,121 +10,84 @@ #include #include -static inline void flush_tlb_current(struct mm_struct *mm) +static inline void local_flush_tlb_all(void) { - unsigned long mmc, asn, ptbr, flags; + tbiv(); +} - local_irq_save(flags); +static inline void local_flush_tlb_mm(struct mm_struct *mm) +{ + int cpu; + unsigned long flags; - mmc = __get_new_mm_context(mm, smp_processor_id()); - mm->context.asid[smp_processor_id()] = mmc; + local_irq_save(flags); - /* - * Force a new ASN for a task. Note that there is no way to - * write UPN only now, so call load_asn_ptbr here. - */ - asn = mmc & HARDWARE_ASN_MASK; - ptbr = virt_to_pfn(mm->pgd); - load_asn_ptbr(asn, ptbr); + cpu = smp_processor_id(); + if (!asid_valid(mm, cpu)) { + cpumask_clear_cpu(cpu, mm_cpumask(mm)); + goto out; + } + if (current->mm == mm) { + __get_new_mm_context(mm, cpu); + wrasid(cpu_asid(cpu, mm)); + } else { + mm->context.asid[cpu] = 0; + cpumask_clear_cpu(cpu, mm_cpumask(mm)); + } +out: local_irq_restore(flags); } -/* - * Flush just one page in the current TLB set. We need to be very - * careful about the icache here, there is no way to invalidate a - * specific icache page. - */ - -static inline void flush_tlb_current_page(struct mm_struct *mm, - struct vm_area_struct *vma, - unsigned long addr) -{ - if (vma->vm_flags & VM_EXEC) - tbis(addr); - else - tbisd(addr); -} - - -/* Flush current user mapping. */ -static inline void flush_tlb(void) +static inline void +local_flush_tlb_page(struct vm_area_struct *vma, unsigned long addr) { - flush_tlb_current(current->active_mm); -} + int cpu; + struct mm_struct *mm; -/* Flush someone else's user mapping. */ -static inline void flush_tlb_other(struct mm_struct *mm) -{ - unsigned long *mmc; + cpu = smp_processor_id(); + mm = vma->vm_mm; - if (mm) { - mmc = &mm->context.asid[smp_processor_id()]; - /* - * Check it's not zero first to avoid cacheline ping pong - * when possible. - */ - if (*mmc) - *mmc = 0; - } + if (asid_valid(mm, cpu)) + tbisasid(cpu_asid(cpu, mm), addr); + else + cpumask_clear_cpu(cpu, mm_cpumask(mm)); } -#ifndef CONFIG_SMP /* - * Flush everything (kernel mapping may also have changed - * due to vmalloc/vfree). + * It flushes the whole user tlb now. */ -static inline void flush_tlb_all(void) -{ - tbiv(); -} - -/* Flush a specified user mapping. */ static inline void -flush_tlb_mm(struct mm_struct *mm) +local_flush_tlb_range(struct vm_area_struct *vma, + unsigned long start, unsigned long end) { - if (mm == current->mm) - flush_tlb_current(mm); - else - flush_tlb_other(mm); -} - -/* Page-granular tlb flush. */ -static inline void flush_tlb_page(struct vm_area_struct *vma, - unsigned long addr) -{ - struct mm_struct *mm = vma->vm_mm; - - if (mm == current->mm) - flush_tlb_current_page(mm, vma, addr); - else - flush_tlb_other(mm); + local_flush_tlb_mm(vma->vm_mm); } /* - * Flush a specified range of user mapping. On the sw64 we flush - * the whole user tlb. + * There is no way to invalidate kernel pages only, so it has to + * inlvalidate all mapping. */ -static inline void flush_tlb_range(struct vm_area_struct *vma, - unsigned long start, unsigned long end) +static inline void +local_flush_tlb_kernel_range(unsigned long start, unsigned long end) { - flush_tlb_mm(vma->vm_mm); + local_flush_tlb_all(); } -#else /* CONFIG_SMP */ - +#ifdef CONFIG_SMP extern void flush_tlb_all(void); extern void flush_tlb_mm(struct mm_struct *); extern void flush_tlb_page(struct vm_area_struct *, unsigned long); extern void flush_tlb_range(struct vm_area_struct *, unsigned long, unsigned long); +extern void flush_tlb_kernel_range(unsigned long, unsigned long); +#else +#define flush_tlb_all() local_flush_tlb_all() +#define flush_tlb_mm(mm) local_flush_tlb_mm(mm) +#define flush_tlb_page(vma, addr) local_flush_tlb_page(vma, addr) +#define flush_tlb_range(vma, start, end) local_flush_tlb_range(vma, start, end) +#define flush_tlb_kernel_range(start, end) local_flush_tlb_kernel_range(start, end) #endif /* CONFIG_SMP */ -static inline void flush_tlb_kernel_range(unsigned long start, - unsigned long end) -{ - flush_tlb_all(); -} - #endif /* _ASM_SW64_TLBFLUSH_H */ diff --git a/arch/sw_64/include/asm/uprobes.h b/arch/sw_64/include/asm/uprobes.h index 97b67af25bce2fdb049179aed8f4e57f1c0772c1..2a5b268cb88f41a050a9b871670ad935651d0f6c 100644 --- a/arch/sw_64/include/asm/uprobes.h +++ b/arch/sw_64/include/asm/uprobes.h @@ -35,4 +35,6 @@ struct arch_uprobe_task { unsigned long saved_trap_nr; }; +extern void sw64_fix_uretprobe(struct pt_regs *regs); + #endif /* _ASM_SW64_UPROBES_H */ diff --git a/arch/sw_64/include/asm/vcpu.h b/arch/sw_64/include/asm/vcpu.h index 476c396c5aa403de009b7de90e5fba9cbf516c03..c43ebe72e3a1e513b4e8f4e718e1190cc34a8d8e 100644 --- a/arch/sw_64/include/asm/vcpu.h +++ b/arch/sw_64/include/asm/vcpu.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_SW64_VCPU_H -#define _ASM_SW64_VCPU_H +#define _ASM_SW64_VCPU_H #ifndef __ASSEMBLY__ @@ -41,7 +41,17 @@ struct vcpucb { unsigned long exit_reason; unsigned long ipaddr; unsigned long vcpu_irq_vector; + unsigned long pri_base; + unsigned long stack_pc_dfault; + unsigned long guest_p20; + unsigned long guest_dfault_double; + unsigned long guest_irqs_pending; + unsigned long guest_hm_r30; + unsigned long migration_mark; + unsigned long guest_longtime; + unsigned long guest_longtime_offset; + unsigned long reserved[3]; }; -#endif /* __ASSEMBLY__ */ -#endif /* _ASM_SW64_VCPU_H */ +#endif /* __ASSEMBLY__ */ +#endif /* _ASM_SW64_VCPU_H */ diff --git a/arch/sw_64/include/asm/wrperfmon.h b/arch/sw_64/include/asm/wrperfmon.h index 15f7f6beb07c0606924c0c1e74a88762f8b88ed5..c06a05121a68be93e265928f0651bfda2ad43ac8 100644 --- a/arch/sw_64/include/asm/wrperfmon.h +++ b/arch/sw_64/include/asm/wrperfmon.h @@ -61,4 +61,4 @@ #define MAX_HWEVENTS 2 #define PMC_COUNT_MASK ((1UL << 58) - 1) -#endif +#endif /* _ASM_SW64_WRPERFMON_H */ diff --git a/arch/sw_64/include/asm/xchg.h b/arch/sw_64/include/asm/xchg.h index bac67623da91442716be7df6b561c2bb91ae087d..ba4e6d1a27ad064aeef83ec4e4a2b2c89181093a 100644 --- a/arch/sw_64/include/asm/xchg.h +++ b/arch/sw_64/include/asm/xchg.h @@ -1,7 +1,10 @@ /* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_SW64_XCHG_H +#define _ASM_SW64_XCHG_H + #ifndef _ASM_SW64_CMPXCHG_H -#error Do not include xchg.h directly! -#else +#error Do not include xchg.h directly. Use cmpxchg.h +#endif /* * xchg/xchg_local and cmpxchg/cmpxchg_local share the same code * except that local version do not have the expensive memory barrier. @@ -325,4 +328,4 @@ static __always_inline unsigned long ____cmpxchg(, volatile void *ptr, return old; } -#endif +#endif /* _ASM_SW64_XCHG_H */ diff --git a/arch/sw_64/include/asm/xor.h b/arch/sw_64/include/asm/xor.h index af95259ed8ef90fe26a9d4a8f40fcab2c5250105..e9731f2a8f12302bf3cbf768ba915203862bdc11 100644 --- a/arch/sw_64/include/asm/xor.h +++ b/arch/sw_64/include/asm/xor.h @@ -844,4 +844,4 @@ static struct xor_block_template xor_block_sw64_prefetch = { */ #define XOR_SELECT_TEMPLATE(FASTEST) (&xor_block_sw64_prefetch) -#endif +#endif /* _ASM_SW64_XOR_H */ diff --git a/arch/sw_64/include/uapi/asm/errno.h b/arch/sw_64/include/uapi/asm/errno.h index 0d8438f6bd402aea665d96c8f7d983271ad91d24..969ee99ee86c7a72c125a903e438a2373cf36c4a 100644 --- a/arch/sw_64/include/uapi/asm/errno.h +++ b/arch/sw_64/include/uapi/asm/errno.h @@ -4,125 +4,125 @@ #include -#undef EAGAIN /* 11 in errno-base.h */ - -#define EDEADLK 11 /* Resource deadlock would occur */ - -#define EAGAIN 35 /* Try again */ -#define EWOULDBLOCK EAGAIN /* Operation would block */ -#define EINPROGRESS 36 /* Operation now in progress */ -#define EALREADY 37 /* Operation already in progress */ -#define ENOTSOCK 38 /* Socket operation on non-socket */ -#define EDESTADDRREQ 39 /* Destination address required */ -#define EMSGSIZE 40 /* Message too long */ -#define EPROTOTYPE 41 /* Protocol wrong type for socket */ -#define ENOPROTOOPT 42 /* Protocol not available */ -#define EPROTONOSUPPORT 43 /* Protocol not supported */ -#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ -#define EOPNOTSUPP 45 /* Operation not supported on transport endpoint */ -#define EPFNOSUPPORT 46 /* Protocol family not supported */ -#define EAFNOSUPPORT 47 /* Address family not supported by protocol */ -#define EADDRINUSE 48 /* Address already in use */ -#define EADDRNOTAVAIL 49 /* Cannot assign requested address */ -#define ENETDOWN 50 /* Network is down */ -#define ENETUNREACH 51 /* Network is unreachable */ -#define ENETRESET 52 /* Network dropped connection because of reset */ -#define ECONNABORTED 53 /* Software caused connection abort */ -#define ECONNRESET 54 /* Connection reset by peer */ -#define ENOBUFS 55 /* No buffer space available */ -#define EISCONN 56 /* Transport endpoint is already connected */ -#define ENOTCONN 57 /* Transport endpoint is not connected */ -#define ESHUTDOWN 58 /* Cannot send after transport endpoint shutdown */ -#define ETOOMANYREFS 59 /* Too many references: cannot splice */ -#define ETIMEDOUT 60 /* Connection timed out */ -#define ECONNREFUSED 61 /* Connection refused */ -#define ELOOP 62 /* Too many symbolic links encountered */ -#define ENAMETOOLONG 63 /* File name too long */ -#define EHOSTDOWN 64 /* Host is down */ -#define EHOSTUNREACH 65 /* No route to host */ -#define ENOTEMPTY 66 /* Directory not empty */ - -#define EUSERS 68 /* Too many users */ -#define EDQUOT 69 /* Quota exceeded */ -#define ESTALE 70 /* Stale NFS file handle */ -#define EREMOTE 71 /* Object is remote */ - -#define ENOLCK 77 /* No record locks available */ -#define ENOSYS 78 /* Function not implemented */ - -#define ENOMSG 80 /* No message of desired type */ -#define EIDRM 81 /* Identifier removed */ -#define ENOSR 82 /* Out of streams resources */ -#define ETIME 83 /* Timer expired */ -#define EBADMSG 84 /* Not a data message */ -#define EPROTO 85 /* Protocol error */ -#define ENODATA 86 /* No data available */ -#define ENOSTR 87 /* Device not a stream */ - -#define ENOPKG 92 /* Package not installed */ - -#define EILSEQ 116 /* Illegal byte sequence */ +#undef EAGAIN /* 11 in errno-base.h */ + +#define EDEADLK 11 /* Resource deadlock would occur */ + +#define EAGAIN 35 /* Try again */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define EINPROGRESS 36 /* Operation now in progress */ +#define EALREADY 37 /* Operation already in progress */ +#define ENOTSOCK 38 /* Socket operation on non-socket */ +#define EDESTADDRREQ 39 /* Destination address required */ +#define EMSGSIZE 40 /* Message too long */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Address family not supported by protocol */ +#define EADDRINUSE 48 /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Cannot assign requested address */ +#define ENETDOWN 50 /* Network is down */ +#define ENETUNREACH 51 /* Network is unreachable */ +#define ENETRESET 52 /* Network dropped connection because of reset */ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN 56 /* Transport endpoint is already connected */ +#define ENOTCONN 57 /* Transport endpoint is not connected */ +#define ESHUTDOWN 58 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 59 /* Too many references: cannot splice */ +#define ETIMEDOUT 60 /* Connection timed out */ +#define ECONNREFUSED 61 /* Connection refused */ +#define ELOOP 62 /* Too many symbolic links encountered */ +#define ENAMETOOLONG 63 /* File name too long */ +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ +#define ENOTEMPTY 66 /* Directory not empty */ + +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Quota exceeded */ +#define ESTALE 70 /* Stale NFS file handle */ +#define EREMOTE 71 /* Object is remote */ + +#define ENOLCK 77 /* No record locks available */ +#define ENOSYS 78 /* Function not implemented */ + +#define ENOMSG 80 /* No message of desired type */ +#define EIDRM 81 /* Identifier removed */ +#define ENOSR 82 /* Out of streams resources */ +#define ETIME 83 /* Timer expired */ +#define EBADMSG 84 /* Not a data message */ +#define EPROTO 85 /* Protocol error */ +#define ENODATA 86 /* No data available */ +#define ENOSTR 87 /* Device not a stream */ + +#define ENOPKG 92 /* Package not installed */ + +#define EILSEQ 116 /* Illegal byte sequence */ /* The following are just random noise.. */ -#define ECHRNG 88 /* Channel number out of range */ -#define EL2NSYNC 89 /* Level 2 not synchronized */ -#define EL3HLT 90 /* Level 3 halted */ -#define EL3RST 91 /* Level 3 reset */ - -#define ELNRNG 93 /* Link number out of range */ -#define EUNATCH 94 /* Protocol driver not attached */ -#define ENOCSI 95 /* No CSI structure available */ -#define EL2HLT 96 /* Level 2 halted */ -#define EBADE 97 /* Invalid exchange */ -#define EBADR 98 /* Invalid request descriptor */ -#define EXFULL 99 /* Exchange full */ -#define ENOANO 100 /* No anode */ -#define EBADRQC 101 /* Invalid request code */ -#define EBADSLT 102 /* Invalid slot */ - -#define EDEADLOCK EDEADLK - -#define EBFONT 104 /* Bad font file format */ -#define ENONET 105 /* Machine is not on the network */ -#define ENOLINK 106 /* Link has been severed */ -#define EADV 107 /* Advertise error */ -#define ESRMNT 108 /* Srmount error */ -#define ECOMM 109 /* Communication error on send */ -#define EMULTIHOP 110 /* Multihop attempted */ -#define EDOTDOT 111 /* RFS specific error */ -#define EOVERFLOW 112 /* Value too large for defined data type */ -#define ENOTUNIQ 113 /* Name not unique on network */ -#define EBADFD 114 /* File descriptor in bad state */ -#define EREMCHG 115 /* Remote address changed */ - -#define EUCLEAN 117 /* Structure needs cleaning */ -#define ENOTNAM 118 /* Not a XENIX named type file */ -#define ENAVAIL 119 /* No XENIX semaphores available */ -#define EISNAM 120 /* Is a named type file */ -#define EREMOTEIO 121 /* Remote I/O error */ - -#define ELIBACC 122 /* Can not access a needed shared library */ -#define ELIBBAD 123 /* Accessing a corrupted shared library */ -#define ELIBSCN 124 /* .lib section in a.out corrupted */ -#define ELIBMAX 125 /* Attempting to link in too many shared libraries */ -#define ELIBEXEC 126 /* Cannot exec a shared library directly */ -#define ERESTART 127 /* Interrupted system call should be restarted */ -#define ESTRPIPE 128 /* Streams pipe error */ +#define ECHRNG 88 /* Channel number out of range */ +#define EL2NSYNC 89 /* Level 2 not synchronized */ +#define EL3HLT 90 /* Level 3 halted */ +#define EL3RST 91 /* Level 3 reset */ + +#define ELNRNG 93 /* Link number out of range */ +#define EUNATCH 94 /* Protocol driver not attached */ +#define ENOCSI 95 /* No CSI structure available */ +#define EL2HLT 96 /* Level 2 halted */ +#define EBADE 97 /* Invalid exchange */ +#define EBADR 98 /* Invalid request descriptor */ +#define EXFULL 99 /* Exchange full */ +#define ENOANO 100 /* No anode */ +#define EBADRQC 101 /* Invalid request code */ +#define EBADSLT 102 /* Invalid slot */ + +#define EDEADLOCK EDEADLK + +#define EBFONT 104 /* Bad font file format */ +#define ENONET 105 /* Machine is not on the network */ +#define ENOLINK 106 /* Link has been severed */ +#define EADV 107 /* Advertise error */ +#define ESRMNT 108 /* Srmount error */ +#define ECOMM 109 /* Communication error on send */ +#define EMULTIHOP 110 /* Multihop attempted */ +#define EDOTDOT 111 /* RFS specific error */ +#define EOVERFLOW 112 /* Value too large for defined data type */ +#define ENOTUNIQ 113 /* Name not unique on network */ +#define EBADFD 114 /* File descriptor in bad state */ +#define EREMCHG 115 /* Remote address changed */ + +#define EUCLEAN 117 /* Structure needs cleaning */ +#define ENOTNAM 118 /* Not a XENIX named type file */ +#define ENAVAIL 119 /* No XENIX semaphores available */ +#define EISNAM 120 /* Is a named type file */ +#define EREMOTEIO 121 /* Remote I/O error */ + +#define ELIBACC 122 /* Can not access a needed shared library */ +#define ELIBBAD 123 /* Accessing a corrupted shared library */ +#define ELIBSCN 124 /* .lib section in a.out corrupted */ +#define ELIBMAX 125 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 126 /* Cannot exec a shared library directly */ +#define ERESTART 127 /* Interrupted system call should be restarted */ +#define ESTRPIPE 128 /* Streams pipe error */ #define ENOMEDIUM 129 /* No medium found */ #define EMEDIUMTYPE 130 /* Wrong medium type */ -#define ECANCELED 131 /* Operation Cancelled */ -#define ENOKEY 132 /* Required key not available */ -#define EKEYEXPIRED 133 /* Key has expired */ -#define EKEYREVOKED 134 /* Key has been revoked */ -#define EKEYREJECTED 135 /* Key was rejected by service */ +#define ECANCELED 131 /* Operation Cancelled */ +#define ENOKEY 132 /* Required key not available */ +#define EKEYEXPIRED 133 /* Key has expired */ +#define EKEYREVOKED 134 /* Key has been revoked */ +#define EKEYREJECTED 135 /* Key was rejected by service */ /* for robust mutexes */ -#define EOWNERDEAD 136 /* Owner died */ -#define ENOTRECOVERABLE 137 /* State not recoverable */ +#define EOWNERDEAD 136 /* Owner died */ +#define ENOTRECOVERABLE 137 /* State not recoverable */ -#define ERFKILL 138 /* Operation not possible due to RF-kill */ +#define ERFKILL 138 /* Operation not possible due to RF-kill */ #define EHWPOISON 139 /* Memory page has hardware error */ -#endif +#endif /* _UAPI_ASM_SW64_ERRNO_H */ diff --git a/arch/sw_64/include/uapi/asm/fcntl.h b/arch/sw_64/include/uapi/asm/fcntl.h index 99e1a31c5e8606000808bd62c6a6db25c0982501..be2daae2cc4dc1a1f7d9a8b653ade486e7329db9 100644 --- a/arch/sw_64/include/uapi/asm/fcntl.h +++ b/arch/sw_64/include/uapi/asm/fcntl.h @@ -55,4 +55,4 @@ #include -#endif +#endif /* _UAPI_ASM_SW64_FCNTL_H */ diff --git a/arch/sw_64/include/uapi/asm/hmcall.h b/arch/sw_64/include/uapi/asm/hmcall.h index dcff778e16163e0cdac3ae23b056dd8ccd263899..6867fb7b4d244ee325b1d6294d1cae7453246af2 100644 --- a/arch/sw_64/include/uapi/asm/hmcall.h +++ b/arch/sw_64/include/uapi/asm/hmcall.h @@ -14,4 +14,4 @@ #define HMC_gentrap 0xAA #define HMC_wrperfmon 0xB0 -#endif +#endif /* _UAPI_ASM_SW64_HMCALL_H */ diff --git a/arch/sw_64/include/uapi/asm/ioctls.h b/arch/sw_64/include/uapi/asm/ioctls.h index db8e456290e6592da5e15e7d68b4449729b9ffb9..751a07fd0303d29f0979a2c9acb051b4329612e0 100644 --- a/arch/sw_64/include/uapi/asm/ioctls.h +++ b/arch/sw_64/include/uapi/asm/ioctls.h @@ -34,8 +34,8 @@ #define TIOCSWINSZ _IOW('t', 103, struct winsize) #define TIOCGWINSZ _IOR('t', 104, struct winsize) -#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ -#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ +#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ +#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ #define TIOCGLTC _IOR('t', 116, struct ltchars) diff --git a/arch/sw_64/include/uapi/asm/kvm.h b/arch/sw_64/include/uapi/asm/kvm.h index 126c2a1d74110ef6d8eb12b2314e2193c2d5e823..254d6cbf1eb146c53c766c715f2980fb3017ecf5 100644 --- a/arch/sw_64/include/uapi/asm/kvm.h +++ b/arch/sw_64/include/uapi/asm/kvm.h @@ -114,4 +114,4 @@ struct kvm_sync_regs { struct kvm_sregs { }; -#endif /* _UAPI_ASM_SW64_KVM_H */ +#endif /* _UAPI_ASM_SW64_KVM_H */ diff --git a/arch/sw_64/include/uapi/asm/perf_regs.h b/arch/sw_64/include/uapi/asm/perf_regs.h index 1378a7397951d6ba3085cf64bdda6ef0453a3932..febde5fd72fb7f95b442060352e6c4a38a7e8fbc 100644 --- a/arch/sw_64/include/uapi/asm/perf_regs.h +++ b/arch/sw_64/include/uapi/asm/perf_regs.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_SW64_PERF_REGS_H -#define _ASM_SW64_PERF_REGS_H +#ifndef _UAPI_ASM_SW64_PERF_REGS_H +#define _UAPI_ASM_SW64_PERF_REGS_H enum perf_event_sw64_regs { PERF_REG_SW64_R0, @@ -42,4 +42,4 @@ enum perf_event_sw64_regs { PERF_REG_SW64_R18, PERF_REG_SW64_MAX, }; -#endif /* _ASM_SW64_PERF_REGS_H */ +#endif /* _UAPI_ASM_SW64_PERF_REGS_H */ diff --git a/arch/sw_64/include/uapi/asm/regdef.h b/arch/sw_64/include/uapi/asm/regdef.h index ad4475b7943517e62b8f0935c442a260bed9fa22..7460a987c7267b85ffbe5238cf258944e7c0309c 100644 --- a/arch/sw_64/include/uapi/asm/regdef.h +++ b/arch/sw_64/include/uapi/asm/regdef.h @@ -13,14 +13,14 @@ #define t6 $7 #define t7 $8 -#define s0 $9 /* saved-registers (callee-saved registers) */ -#define s1 $10 -#define s2 $11 -#define s3 $12 -#define s4 $13 -#define s5 $14 -#define s6 $15 -#define fp s6 /* frame-pointer (s6 in frame-less procedures) */ +#define s0 $9 /* saved-registers (callee-saved registers) */ +#define s1 $10 +#define s2 $11 +#define s3 $12 +#define s4 $13 +#define s5 $14 +#define s6 $15 +#define fp s6 /* frame-pointer (s6 in frame-less procedures) */ #define a0 $16 /* argument registers (caller-saved) */ #define a1 $17 diff --git a/arch/sw_64/include/uapi/asm/setup.h b/arch/sw_64/include/uapi/asm/setup.h index 10ce5dba9c3066a3334f8ecfe59f569403024178..e6cca45250491ca64bfc6a6c473da19f01984bb9 100644 --- a/arch/sw_64/include/uapi/asm/setup.h +++ b/arch/sw_64/include/uapi/asm/setup.h @@ -4,4 +4,4 @@ #define COMMAND_LINE_SIZE 2048 -#endif +#endif /* _UAPI_ASM_SW64_SETUP_H */ diff --git a/arch/sw_64/include/uapi/asm/sigcontext.h b/arch/sw_64/include/uapi/asm/sigcontext.h index 11d7eece86efa8e50c6ce5b7fb71e36341aad88a..08a0814703830370efae670d59f4262b7da50dbd 100644 --- a/arch/sw_64/include/uapi/asm/sigcontext.h +++ b/arch/sw_64/include/uapi/asm/sigcontext.h @@ -31,4 +31,4 @@ struct sigcontext { }; -#endif +#endif /* _UAPI_ASM_SW64_SIGCONTEXT_H */ diff --git a/arch/sw_64/include/uapi/asm/siginfo.h b/arch/sw_64/include/uapi/asm/siginfo.h index 4a58eea9b67c9ab254f7142aeb37bf70758b5d8a..28c656c283132e1771179391d0c5a95144b470e4 100644 --- a/arch/sw_64/include/uapi/asm/siginfo.h +++ b/arch/sw_64/include/uapi/asm/siginfo.h @@ -8,4 +8,4 @@ #include -#endif +#endif /* _UAPI_ASM_SW64_SIGINFO_H */ diff --git a/arch/sw_64/include/uapi/asm/stat.h b/arch/sw_64/include/uapi/asm/stat.h index d2b21128c56947bfeef183113ba6a51e149a91a1..25aad21f4d31c7beda0f023f8a0dd7e21db52fac 100644 --- a/arch/sw_64/include/uapi/asm/stat.h +++ b/arch/sw_64/include/uapi/asm/stat.h @@ -48,4 +48,4 @@ struct stat64 { long __unused[3]; }; -#endif +#endif /* _UAPI_ASM_SW64_STAT_H */ diff --git a/arch/sw_64/include/uapi/asm/termbits.h b/arch/sw_64/include/uapi/asm/termbits.h index 83de6ff63234f69a7ddf3b169c4e204961640d3d..aaadb1d54f92e585db9b843444c1d6a198a20fe9 100644 --- a/arch/sw_64/include/uapi/asm/termbits.h +++ b/arch/sw_64/include/uapi/asm/termbits.h @@ -87,73 +87,73 @@ struct ktermios { #define OFILL 00000100 #define OFDEL 00000200 #define NLDLY 00001400 -#define NL0 00000000 -#define NL1 00000400 -#define NL2 00001000 -#define NL3 00001400 +#define NL0 00000000 +#define NL1 00000400 +#define NL2 00001000 +#define NL3 00001400 #define TABDLY 00006000 -#define TAB0 00000000 -#define TAB1 00002000 -#define TAB2 00004000 -#define TAB3 00006000 -#define CRDLY 00030000 -#define CR0 00000000 -#define CR1 00010000 -#define CR2 00020000 -#define CR3 00030000 +#define TAB0 00000000 +#define TAB1 00002000 +#define TAB2 00004000 +#define TAB3 00006000 +#define CRDLY 00030000 +#define CR0 00000000 +#define CR1 00010000 +#define CR2 00020000 +#define CR3 00030000 #define FFDLY 00040000 -#define FF0 00000000 -#define FF1 00040000 +#define FF0 00000000 +#define FF1 00040000 #define BSDLY 00100000 -#define BS0 00000000 -#define BS1 00100000 +#define BS0 00000000 +#define BS1 00100000 #define VTDLY 00200000 -#define VT0 00000000 -#define VT1 00200000 +#define VT0 00000000 +#define VT1 00200000 #define XTABS 01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */ /* c_cflag bit meaning */ #define CBAUD 0000037 -#define B0 0000000 /* hang up */ -#define B50 0000001 -#define B75 0000002 -#define B110 0000003 -#define B134 0000004 -#define B150 0000005 -#define B200 0000006 -#define B300 0000007 -#define B600 0000010 -#define B1200 0000011 -#define B1800 0000012 -#define B2400 0000013 -#define B4800 0000014 -#define B9600 0000015 -#define B19200 0000016 -#define B38400 0000017 +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 #define EXTA B19200 #define EXTB B38400 #define CBAUDEX 0000000 -#define B57600 00020 -#define B115200 00021 -#define B230400 00022 -#define B460800 00023 -#define B500000 00024 -#define B576000 00025 -#define B921600 00026 -#define B1000000 00027 -#define B1152000 00030 -#define B1500000 00031 -#define B2000000 00032 -#define B2500000 00033 -#define B3000000 00034 -#define B3500000 00035 -#define B4000000 00036 +#define B57600 00020 +#define B115200 00021 +#define B230400 00022 +#define B460800 00023 +#define B500000 00024 +#define B576000 00025 +#define B921600 00026 +#define B1000000 00027 +#define B1152000 00030 +#define B1500000 00031 +#define B2000000 00032 +#define B2500000 00033 +#define B3000000 00034 +#define B3500000 00035 +#define B4000000 00036 #define CSIZE 00001400 -#define CS5 00000000 -#define CS6 00000400 -#define CS7 00001000 -#define CS8 00001400 +#define CS5 00000000 +#define CS6 00000400 +#define CS7 00001000 +#define CS8 00001400 #define CSTOPB 00002000 #define CREAD 00004000 @@ -184,19 +184,19 @@ struct ktermios { #define EXTPROC 0x10000000 /* Values for the ACTION argument to `tcflow'. */ -#define TCOOFF 0 -#define TCOON 1 -#define TCIOFF 2 -#define TCION 3 +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 /* Values for the QUEUE_SELECTOR argument to `tcflush'. */ -#define TCIFLUSH 0 -#define TCOFLUSH 1 -#define TCIOFLUSH 2 +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 /* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */ -#define TCSANOW 0 -#define TCSADRAIN 1 -#define TCSAFLUSH 2 +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 #endif /* _UAPI_ASM_SW64_TERMBITS_H */ diff --git a/arch/sw_64/kernel/Makefile b/arch/sw_64/kernel/Makefile index 02facabae2d9f736d121b1f8b628748af501b484..850f6dfddd1fe6a761458c86dfb57f228829ee5e 100644 --- a/arch/sw_64/kernel/Makefile +++ b/arch/sw_64/kernel/Makefile @@ -17,10 +17,9 @@ obj-y := entry.o fpu.o traps.o process.o sys_sw64.o irq.o \ irq_sw64.o signal.o setup.o ptrace.o time.o \ systbls.o dup_print.o tc.o timer.o \ insn.o early_init.o topology.o cacheinfo.o \ - vdso.o vdso/ hmcall.o + vdso.o vdso/ hmcall.o stacktrace.o obj-$(CONFIG_ACPI) += acpi.o -obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_PCI) += pci.o pci-sysfs.o obj-$(CONFIG_MODULES) += module.o diff --git a/arch/sw_64/kernel/acpi.c b/arch/sw_64/kernel/acpi.c index a0b5c4a57a07e698a8fd6e05c171e16c14a16c7e..61f2948f17818ef4d5fee71d3bef177792436c03 100644 --- a/arch/sw_64/kernel/acpi.c +++ b/arch/sw_64/kernel/acpi.c @@ -97,7 +97,7 @@ int acpi_unmap_lsapic(int cpu) return 0; } EXPORT_SYMBOL(acpi_unmap_lsapic); -#endif /* CONFIG_ACPI_HOTPLUG_CPU */ +#endif /* CONFIG_ACPI_HOTPLUG_CPU */ u8 acpi_checksum(u8 *table, u32 length) { @@ -361,7 +361,7 @@ int acpi_unmap_cpu(int cpu) return 0; } EXPORT_SYMBOL(acpi_unmap_cpu); -#endif /* CONFIG_ACPI_HOTPLUG_CPU */ +#endif /* CONFIG_ACPI_HOTPLUG_CPU */ void __init acpi_boot_table_init(void) diff --git a/arch/sw_64/kernel/dup_print.c b/arch/sw_64/kernel/dup_print.c index 02639f40a4bc6d5901344c41249f34c8bc8305be..3a32c444207d89f2c4e472786d29704798217dc6 100644 --- a/arch/sw_64/kernel/dup_print.c +++ b/arch/sw_64/kernel/dup_print.c @@ -52,6 +52,8 @@ int sw64_printk(const char *fmt, va_list args) #endif #ifdef CONFIG_SW64_RRU +#include + static DEFINE_SPINLOCK(printf_lock); #define USER_PRINT_BUFF_BASE (0x600000UL + __START_KERNEL_map) #define USER_PRINT_BUFF_LEN 0x100000UL diff --git a/arch/sw_64/kernel/entry-ftrace.S b/arch/sw_64/kernel/entry-ftrace.S index 3f88a9fe2e3eb08ccd671f70e60aaa23249e33b8..223dd5fc0808bdef3c26cb90547ffe5c2b6eb38e 100644 --- a/arch/sw_64/kernel/entry-ftrace.S +++ b/arch/sw_64/kernel/entry-ftrace.S @@ -79,7 +79,7 @@ ftrace_graph_call: /* ftrace_graph_caller(); */ /* "br ftrace_graph_caller" */ #endif mcount_end - ret $31, ($28), 1 + ret $31, ($28), 1 .end ftrace_caller #else /* !CONFIG_DYNAMIC_FTRACE */ diff --git a/arch/sw_64/kernel/entry.S b/arch/sw_64/kernel/entry.S index 67bafd4a930aa3423230644b925e918b883a787a..cfb8e7c6d7fba2cd9493734cfa7261e7dd2f4e11 100644 --- a/arch/sw_64/kernel/entry.S +++ b/arch/sw_64/kernel/entry.S @@ -403,7 +403,7 @@ __switch_to: stl $15, TASK_THREAD_S6($16) /* Restore context from next->thread */ ldl $26, TASK_THREAD_RA($17) - ldl $30, TASK_THREAD_SP($17) + ldl $30, TASK_THREAD_SP($17) ldl $9, TASK_THREAD_S0($17) ldl $10, TASK_THREAD_S1($17) ldl $11, TASK_THREAD_S2($17) diff --git a/arch/sw_64/kernel/head.S b/arch/sw_64/kernel/head.S index 3dfb95c91d70b061f28439580a695f1d0370a83a..7cce2a8859e566f74142a15ec54024faa484c967 100644 --- a/arch/sw_64/kernel/head.S +++ b/arch/sw_64/kernel/head.S @@ -26,23 +26,11 @@ __start: /* ... and find our stack ... */ ldi $30, ASM_THREAD_SIZE($8) /* ... and then we can clear bss data. */ - ldi $2, __bss_start - ldi $3, __bss_stop - /* 8 bytes alignment */ -1: and $2, 0x7, $1 # align check - bne $1, 3f -2: subl $3, $2, $1 # align clear - ble $1, 4f - subl $1, 0x8, $1 - ble $1, 3f - stl $31, 0($2) - addl $2, 8, $2 - br $31, 2b -3: stb $31, 0($2) # non align clear - addl $2, 1, $2 - subl $3, $2, $1 - bgt $1, 1b -4:# finish clear + ldi $16, __bss_start + ldi $18, __bss_stop + subl $18, $16, $18 + mov $31, $17 + call $26, __constant_c_memset #ifdef CONFIG_RELOCATABLE ldi $30, -8($30) stl $29, 0($30) diff --git a/arch/sw_64/kernel/hmcall.c b/arch/sw_64/kernel/hmcall.c index b81d7fff1c347d58f3c03935f76d532eb35d093c..3d60569a4f6f0845a83ecba9bce30db0c9761f2c 100644 --- a/arch/sw_64/kernel/hmcall.c +++ b/arch/sw_64/kernel/hmcall.c @@ -38,11 +38,51 @@ static inline void fixup_wrtp(void) entry[1] = 0x1ee00000; /* pri_ret $23 */ } +static inline void fixup_tbiasid(void) +{ + unsigned int *entry = __va(HMCALL_ENTRY(tbisasid)); + + entry[0] = 0x18fffe47; /* pri_rcsr p7, CSR__DTB_PCR*/ + entry[1] = 0x4a05c905; /* sll r16, CSR__DTB_PCR__UPN__S, p5 */ + entry[2] = 0xf89f03ff; /* ldi p4, CSR__DTB_PCR__UPN__M */ + entry[3] = 0x4885c904; /* sll p4, CSR__DTB_PCR__UPN__S, p4 */ + entry[4] = 0x40e40724; /* bic p7, p4, p4 */ + entry[5] = 0x40850745; /* bis p4, p5, p5 */ + entry[6] = 0x18bfff47; /* pri_wcsr p5, CSR__DTB_PCR */ + entry[7] = 0x1a3fff46; /* pri_wcsr r17, CSR__DTB_IS */ + entry[8] = 0x18ffff47; /* pri_wcsr p7, CSR__DTB_PCR */ + entry[9] = 0x4a04e906; /* sll r16, CSR__UPCR_UPN__UPN__S, p6 */ + entry[10] = 0x189ffe22; /* pri_rcsr p4, CSR__UPCR_UPN */ + entry[11] = 0x18dfff22; /* pri_wcsr p6, CSR__UPCR_UPN */ + entry[12] = 0x1a3fff06; /* pri_wcsr r17, CSR__ITB_IS */ + entry[13] = 0x1bffff15; /* pri_wcsr r31, CSR__IC_FLUSH */ + entry[14] = 0x189fff22; /* pri_wcsr p4, CSR__UPCR_UPN */ + entry[15] = 0x1ef00000; /* pri_ret/b p23 */ +} + +static inline void fixup_wrasid(void) +{ + unsigned int *entry = __va(HMCALL_ENTRY(wrasid)); + + entry[0] = 0x18fffe47; /* pri_rcsr p7, CSR__DTB_PCR*/ + entry[1] = 0x4a05c905; /* sll r16, CSR__DTB_PCR__UPN__S, p5 */ + entry[2] = 0xf89f03ff; /* ldi p4, CSR__DTB_PCR__UPN__M */ + entry[3] = 0x4885c904; /* sll p4, CSR__DTB_PCR__UPN__S, p4 */ + entry[4] = 0x40e40724; /* bic p7, p4, p4 */ + entry[5] = 0x40850745; /* bis p4, p5, p5 */ + entry[6] = 0x18bfff47; /* pri_wcsr p5, CSR__DTB_PCR */ + entry[7] = 0x4a04e906; /* sll r16, CSR__UPCR_UPN__UPN__S, p6 */ + entry[8] = 0x18dfff22; /* pri_wcsr p4, CSR__UPCR_UPN */ + entry[9] = 0x1ef00000; /* pri_ret/b p23 */ +} + void __init fixup_hmcall(void) { -#if defined(CONFIG_SUBARCH_C3A) || defined(CONFIG_SUBARCH_C3B) +#if defined(CONFIG_SUBARCH_C3B) fixup_rdtp(); fixup_wrtp(); + fixup_tbiasid(); + fixup_wrasid(); #endif } diff --git a/arch/sw_64/kernel/kprobes/kprobes.c b/arch/sw_64/kernel/kprobes/kprobes.c index 59f040eaa3e17f0f30c26e84f86332363c4a6e58..7080c892a24d1e1fe8acb794548c9a74499baede 100644 --- a/arch/sw_64/kernel/kprobes/kprobes.c +++ b/arch/sw_64/kernel/kprobes/kprobes.c @@ -284,6 +284,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p, orig_ret_address = __kretprobe_trampoline_handler(regs, kretprobe_trampoline, NULL); instruction_pointer(regs) = orig_ret_address; + regs->r26 = orig_ret_address; /* * By returning a non-zero value, we are telling diff --git a/arch/sw_64/kernel/pci_impl.h b/arch/sw_64/kernel/pci_impl.h index 6025145cb1c5c31ae749d892a92028f75d987e38..4262ba94f44b92935e44b46c6de94f0050c2a390 100644 --- a/arch/sw_64/kernel/pci_impl.h +++ b/arch/sw_64/kernel/pci_impl.h @@ -4,7 +4,7 @@ * with the PCI initialization routines. */ #ifndef _SW64_KERNEL_PCI_IMPL_H -#define _SW64_KERNEL_PCI_IMPL_H +#define _SW64_KERNEL_PCI_IMPL_H #include @@ -25,4 +25,4 @@ extern const struct dma_map_ops sw64_dma_direct_ops; extern struct cma *sw64_kvm_cma; extern struct gen_pool *sw64_kvm_pool; -#endif +#endif /* _SW64_KERNEL_PCI_IMPL_H */ diff --git a/arch/sw_64/kernel/perf_event.c b/arch/sw_64/kernel/perf_event.c index 6e344239917b8d703db5870d33930056aac9fe1e..f1f74a968cbc7f3dcf22e12cd334c00ccc2e9ceb 100644 --- a/arch/sw_64/kernel/perf_event.c +++ b/arch/sw_64/kernel/perf_event.c @@ -385,7 +385,6 @@ static int sw64_pmu_add(struct perf_event *event, int flags) int err = 0; unsigned long irq_flags; - perf_pmu_disable(event->pmu); local_irq_save(irq_flags); if (cpuc->pmcs[hwc->idx] == PMC_IN_USE) { @@ -408,7 +407,6 @@ static int sw64_pmu_add(struct perf_event *event, int flags) out: local_irq_restore(irq_flags); - perf_pmu_enable(event->pmu); return err; } @@ -422,24 +420,17 @@ static void sw64_pmu_del(struct perf_event *event, int flags) struct hw_perf_event *hwc = &event->hw; unsigned long irq_flags; - perf_pmu_disable(event->pmu); local_irq_save(irq_flags); - if (cpuc->event[hwc->idx] != event) - goto out; - + sw64_pmu_stop(event, PERF_EF_UPDATE); cpuc->event[hwc->idx] = NULL; cpuc->pmcs[hwc->idx] = PMC_NOT_USE; cpuc->n_events--; - sw64_pmu_stop(event, PERF_EF_UPDATE); - /* Absorb the final count and turn off the event. */ perf_event_update_userpage(event); -out: local_irq_restore(irq_flags); - perf_pmu_enable(event->pmu); } /* @@ -478,6 +469,9 @@ static void sw64_pmu_stop(struct perf_event *event, int flags) struct hw_perf_event *hwc = &event->hw; if (!(hwc->state & PERF_HES_STOPPED)) { + wrperfmon(PERFMON_CMD_DISABLE, hwc->idx == 0 ? + PERFMON_DISABLE_ARGS_PC0 : + PERFMON_DISABLE_ARGS_PC1); hwc->state |= PERF_HES_STOPPED; barrier(); } @@ -486,12 +480,6 @@ static void sw64_pmu_stop(struct perf_event *event, int flags) sw64_perf_event_update(event, hwc, hwc->idx, 0); hwc->state |= PERF_HES_UPTODATE; } - - if (hwc->idx == 0) - wrperfmon(PERFMON_CMD_DISABLE, PERFMON_DISABLE_ARGS_PC0); - else - wrperfmon(PERFMON_CMD_DISABLE, PERFMON_DISABLE_ARGS_PC1); - } /* @@ -659,10 +647,7 @@ static void sw64_perf_event_irq_handler(unsigned long perfmon_num, event = cpuc->event[idx]; if (unlikely(!event)) { - /* This should never occur! */ irq_err_count++; - pr_warn("PMI: No event at index %d!\n", idx); - wrperfmon(PERFMON_CMD_ENABLE, idx == 0 ? PERFMON_DISABLE_ARGS_PC0 : PERFMON_DISABLE_ARGS_PC1); return; } @@ -775,6 +760,38 @@ void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, walk_stackframe(NULL, regs, callchain_trace, entry); } +/* + * Gets the perf_instruction_pointer and perf_misc_flags for guest os. + */ +#undef is_in_guest + +unsigned long perf_instruction_pointer(struct pt_regs *regs) +{ + if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) + return perf_guest_cbs->get_guest_ip(); + + return instruction_pointer(regs); +} + +unsigned long perf_misc_flags(struct pt_regs *regs) +{ + int misc = 0; + + if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) { + if (perf_guest_cbs->is_user_mode()) + misc |= PERF_RECORD_MISC_GUEST_USER; + else + misc |= PERF_RECORD_MISC_GUEST_KERNEL; + } else { + if (user_mode(regs)) + misc |= PERF_RECORD_MISC_USER; + else + misc |= PERF_RECORD_MISC_KERNEL; + } + + return misc; +} + /* * Init call to initialise performance events at kernel startup. */ diff --git a/arch/sw_64/kernel/proto.h b/arch/sw_64/kernel/proto.h index 8c31eca3cc3226a60de293ab2bdc16022d414e10..f908263f925a76c6acee373cf213ccb541bf029b 100644 --- a/arch/sw_64/kernel/proto.h +++ b/arch/sw_64/kernel/proto.h @@ -19,4 +19,4 @@ extern void __init setup_sched_clock(void); extern void __init sw64_sched_clock_init(void); #endif -#endif /* _SW64_PROTO_H */ +#endif /* _SW64_KERNEL_PROTO_H */ diff --git a/arch/sw_64/kernel/ptrace.c b/arch/sw_64/kernel/ptrace.c index f3bc1020eaffef8954235379f5bb9b36cef0201e..e98679d10fae16adee87ae65b08a241f55d986a6 100644 --- a/arch/sw_64/kernel/ptrace.c +++ b/arch/sw_64/kernel/ptrace.c @@ -46,16 +46,6 @@ * zero have no stack-slot and need to be treated specially (see * get_reg/put_reg below). */ -enum { - REG_R0 = 0, - REG_F0 = 32, - REG_FPCR = 63, - REG_PC = 64, - REG_SP = 30, - REG_PS = 31, - REG_GP = 29 -}; - #define R(x) ((size_t) &((struct pt_regs *)0)->x) short regoffsets[32] = { diff --git a/arch/sw_64/kernel/relocate.c b/arch/sw_64/kernel/relocate.c index fe403f9c70c74f35be4fa575ac3d3e743ff5b0e5..792ee1a9c2b1a261706e1e339c7c6ff85e5de20d 100644 --- a/arch/sw_64/kernel/relocate.c +++ b/arch/sw_64/kernel/relocate.c @@ -1,10 +1,8 @@ // SPDX-License-Identifier: GPL-2.0 /* - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. + * Support for kernel relocation at boot time. * - * Support for Kernel relocation at boot time + * Based on arch/mips/kernel/relocate.c * * Copyright (C) 2019 He Sheng * Authors: He Sheng (hesheng05@gmail.com) @@ -15,7 +13,6 @@ #include -#define INITRD_ADDR 0x3000000UL #define KTEXT_MAX 0xffffffffa0000000UL #define RELOCATED(x) ((void *)((unsigned long)x + offset)) @@ -30,8 +27,6 @@ extern unsigned long __start___ex_table; /* Start exception table */ extern unsigned long __stop___ex_table; /* End exception table */ extern union thread_union init_thread_union; -extern void __weak plat_fdt_relocated(void *new_location); - /* * This function may be defined for a platform to perform any post-relocation * fixup necessary. @@ -42,13 +37,6 @@ int __weak plat_post_relocation(long offset) return 0; } - -static void __init sync_icache(void) -{ - // IC_FLUSH - imb(); -} - static int __init apply_r_sw64_refquad(unsigned long *loc_orig, unsigned long *loc_new, unsigned int offset) { *(unsigned long *)loc_new += offset; @@ -166,13 +154,14 @@ static unsigned long __init determine_relocation_offset(void) if (offset < kernel_length) offset += ALIGN(kernel_length, 0x10000); - /* TODO: 119MB is for test */ - offset = (119 << 20); + /* + * TODO:new location should not overlaps initrd, dtb, acpi + * tables, etc. + */ + if ((KTEXT_MAX - (unsigned long)_end) < offset) offset = 0; - // TODO:new location should not overlaps initrd - return offset; } @@ -216,9 +205,7 @@ unsigned int __init relocate_kernel(void) bss_length = (unsigned long)&__bss_stop - (long)&__bss_start; offset = determine_relocation_offset(); - /* Reset the command line now so we don't end up with a duplicate */ - //arcs_cmdline[0] = '\0'; /* Sanity check relocation address */ if (offset && relocation_offset_valid(offset)) { @@ -232,9 +219,6 @@ unsigned int __init relocate_kernel(void) if (res < 0) goto out; - /* Sync the caches ready for execution of new kernel */ - sync_icache(); - res = relocate_got(offset); if (res < 0) goto out; @@ -259,7 +243,6 @@ unsigned int __init relocate_kernel(void) __current_thread_info = RELOCATED(&init_thread_union); /* Return the new kernel's offset */ - //printk("loc_new:%p, start_kernel: %p, gp:%p\n", loc_new, kernel_entry, kgp); return offset; } out: diff --git a/arch/sw_64/kernel/setup.c b/arch/sw_64/kernel/setup.c index 2d2a8c6d4b4e6eea55b91e84b5931758a7c05527..d4c97741616f5018d238a67c55232c437f435738 100644 --- a/arch/sw_64/kernel/setup.c +++ b/arch/sw_64/kernel/setup.c @@ -143,7 +143,7 @@ EXPORT_SYMBOL(screen_info); */ void store_cpu_data(int cpu) { - cpu_data[cpu].last_asn = ASN_FIRST_VERSION; + cpu_data[cpu].last_asid = ASID_FIRST_VERSION; } #ifdef CONFIG_KEXEC @@ -785,7 +785,7 @@ setup_arch(char **cmdline_p) strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); strlcat(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); } -#endif /* CMDLINE_EXTEND */ +#endif /* CMDLINE_EXTEND */ #endif if (IS_ENABLED(CONFIG_SW64_CHIP3_ASIC_DEBUG) && IS_ENABLED(CONFIG_SW64_CHIP3)) { diff --git a/arch/sw_64/kernel/signal.c b/arch/sw_64/kernel/signal.c index 32c9484d2aa2e3f05d0d48957f5acc197159ebd1..b80cf0e56224485e41e27ffe7ef49c093f559f76 100644 --- a/arch/sw_64/kernel/signal.c +++ b/arch/sw_64/kernel/signal.c @@ -261,7 +261,7 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) { - unsigned long oldsp, r26, err = 0; + unsigned long oldsp, err = 0; struct rt_sigframe __user *frame; oldsp = rdusp(); @@ -283,13 +283,8 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) if (err) return -EFAULT; - /* Set up to return from userspace. If provided, use a stub - * already in userspace. - */ - r26 = VDSO_SYMBOL(current->mm->context.vdso, rt_sigreturn); - /* "Return" to the handler */ - regs->r26 = r26; + regs->r26 = VDSO_SYMBOL(current->mm->context.vdso, rt_sigreturn); regs->r27 = regs->pc = (unsigned long) ksig->ka.sa.sa_handler; regs->r16 = ksig->sig; /* a0: signal number */ if (ksig->ka.sa.sa_flags & SA_SIGINFO) { diff --git a/arch/sw_64/kernel/smp.c b/arch/sw_64/kernel/smp.c index c0936d119c4ed62c19b43fe37a295a72a27271b3..ecf276e9e364af3cd44fb496cfab4d0163c8d9c5 100644 --- a/arch/sw_64/kernel/smp.c +++ b/arch/sw_64/kernel/smp.c @@ -478,7 +478,7 @@ void native_send_call_func_single_ipi(int cpu) static void ipi_flush_tlb_all(void *ignored) { - tbiv(); + local_flush_tlb_all(); } void flush_tlb_all(void) @@ -491,108 +491,102 @@ void flush_tlb_all(void) static void ipi_flush_tlb_mm(void *x) { - struct mm_struct *mm = (struct mm_struct *) x; - - if (mm == current->mm) - flush_tlb_current(mm); - else - flush_tlb_other(mm); + local_flush_tlb_mm((struct mm_struct *)x); } void flush_tlb_mm(struct mm_struct *mm) { - preempt_disable(); /* happens as a result of exit_mmap() * Shall we clear mm->context.asid[] here? */ if (atomic_read(&mm->mm_users) == 0) { - preempt_enable(); return; } - if (mm == current->mm) { - flush_tlb_current(mm); - if (atomic_read(&mm->mm_users) == 1) { - int cpu, this_cpu = smp_processor_id(); + preempt_disable(); - for (cpu = 0; cpu < NR_CPUS; cpu++) { - if (!cpu_online(cpu) || cpu == this_cpu) - continue; - if (mm->context.asid[cpu]) - mm->context.asid[cpu] = 0; - } - preempt_enable(); - return; - } - } else - flush_tlb_other(mm); + if (atomic_read(&mm->mm_users) != 1 || mm != current->mm) { + on_each_cpu_mask(mm_cpumask(mm), ipi_flush_tlb_mm, mm, 1); + } else { + int cpu, this_cpu = smp_processor_id(); - smp_call_function(ipi_flush_tlb_mm, mm, 1); + for_each_online_cpu(cpu) { + if (cpu != this_cpu && mm->context.asid[cpu]) + mm->context.asid[cpu] = 0; + } + local_flush_tlb_mm(mm); + } preempt_enable(); } EXPORT_SYMBOL(flush_tlb_mm); -struct flush_tlb_page_struct { +struct flush_tlb_info { struct vm_area_struct *vma; - struct mm_struct *mm; unsigned long addr; +#define start addr + unsigned long end; }; static void ipi_flush_tlb_page(void *x) { - struct flush_tlb_page_struct *data = (struct flush_tlb_page_struct *)x; - struct mm_struct *mm = data->mm; - - if (mm == current->mm) - flush_tlb_current_page(mm, data->vma, data->addr); - else - flush_tlb_other(mm); + struct flush_tlb_info *info = x; + local_flush_tlb_page(info->vma, info->addr); } void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr) { - struct flush_tlb_page_struct data; struct mm_struct *mm = vma->vm_mm; preempt_disable(); - if (mm == current->mm) { - flush_tlb_current_page(mm, vma, addr); - if (atomic_read(&mm->mm_users) == 1) { - int cpu, this_cpu = smp_processor_id(); - - for (cpu = 0; cpu < NR_CPUS; cpu++) { - if (!cpu_online(cpu) || cpu == this_cpu) - continue; - if (mm->context.asid[cpu]) - mm->context.asid[cpu] = 0; - } - preempt_enable(); - return; + if (atomic_read(&mm->mm_users) != 1 || mm != current->mm) { + struct flush_tlb_info info = { + .vma = vma, + .addr = addr, + }; + on_each_cpu_mask(mm_cpumask(mm), ipi_flush_tlb_page, &info, 1); + } else { + int cpu, this_cpu = smp_processor_id(); + + for_each_online_cpu(cpu) { + if (cpu != this_cpu && mm->context.asid[cpu]) + mm->context.asid[cpu] = 0; } - } else - flush_tlb_other(mm); - - data.vma = vma; - data.mm = mm; - data.addr = addr; - - smp_call_function(ipi_flush_tlb_page, &data, 1); + local_flush_tlb_page(vma, addr); + } preempt_enable(); } EXPORT_SYMBOL(flush_tlb_page); +/* It always flush the whole user tlb by now. To be optimized. */ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end) { - /* On the SW we always flush the whole user tlb. */ flush_tlb_mm(vma->vm_mm); } EXPORT_SYMBOL(flush_tlb_range); +static void ipi_flush_tlb_kernel_range(void *x) +{ + struct flush_tlb_info *info = x; + + local_flush_tlb_kernel_range(info->start, info->end); +} + +void flush_tlb_kernel_range(unsigned long start, unsigned long end) +{ + struct flush_tlb_info info = { + .start = start, + .end = end, + }; + + on_each_cpu(ipi_flush_tlb_kernel_range, &info, 1); +} +EXPORT_SYMBOL(flush_tlb_kernel_range); + int native_cpu_disable(void) { int cpu = smp_processor_id(); @@ -616,6 +610,7 @@ void native_cpu_die(unsigned int cpu) if (per_cpu(cpu_state, cpu) == CPU_DEAD) { if (system_state == SYSTEM_RUNNING) pr_info("CPU %u is now offline\n", cpu); + smp_rcb->ready = 0; return; } msleep(100); diff --git a/arch/sw_64/kernel/suspend.c b/arch/sw_64/kernel/suspend.c index 994d8e245878797917f75a1e1630cc0ff1d09529..b9798baa246745c68bcd21ce98f2d4a8fdaac66e 100644 --- a/arch/sw_64/kernel/suspend.c +++ b/arch/sw_64/kernel/suspend.c @@ -23,6 +23,8 @@ void disable_local_timer(void) wrtimer(0); } +extern struct pci_controller *hose_head; + /* * Boot Core will enter suspend stat here. */ @@ -32,6 +34,11 @@ void sw64_suspend_enter(void) * After wake up boot processor, pc will go here */ +#ifdef CONFIG_SW64_SUPPORT_S3_SLEEPING_STATE + if (sw64_chip->suspend) + sw64_chip->suspend(false); +#endif + disable_local_timer(); current_thread_info()->pcb.tp = rtid(); @@ -43,6 +50,11 @@ void sw64_suspend_enter(void) #endif wrtp(current_thread_info()->pcb.tp); +#ifdef CONFIG_SW64_SUPPORT_S3_SLEEPING_STATE + if (sw64_chip->suspend) + sw64_chip->suspend(true); +#endif + disable_local_timer(); } @@ -57,6 +69,7 @@ static const struct platform_suspend_ops native_suspend_ops = { .valid = native_suspend_state_valid, .enter = native_suspend_enter, }; + static int __init sw64_pm_init(void) { suspend_set_ops(&native_suspend_ops); diff --git a/arch/sw_64/kernel/time.c b/arch/sw_64/kernel/time.c index 3aa55c886e384a8f6d57ec2ee26312321d38560f..32690e78849b8fb54afa7ad22f7f3c59bd9a87f4 100644 --- a/arch/sw_64/kernel/time.c +++ b/arch/sw_64/kernel/time.c @@ -60,7 +60,7 @@ void arch_irq_work_raise(void) set_irq_work_pending_flag(); } -#else /* CONFIG_IRQ_WORK */ +#else /* CONFIG_IRQ_WORK */ #define test_irq_work_pending() 0 #define clear_irq_work_pending() diff --git a/arch/sw_64/kernel/traps.c b/arch/sw_64/kernel/traps.c index f01b88e53ff2dfacbb1b0490c98f5ca6780a2695..b26a0e369ed947cb5308cecf025102ff4bc0cb54 100644 --- a/arch/sw_64/kernel/traps.c +++ b/arch/sw_64/kernel/traps.c @@ -69,7 +69,8 @@ void show_regs(struct pt_regs *regs) regs->r22, regs->r23, regs->r24); printk("t11= %016lx pv = %016lx at = %016lx\n", regs->r25, regs->r27, regs->r28); - printk("gp = %016lx sp = %p\n", regs->gp, regs+1); + printk("gp = %016lx sp = %px\n", regs->gp, + user_mode(regs) ? (void *)rdusp() : (regs + 1)); } static void show_code(unsigned int *pc) @@ -260,18 +261,22 @@ do_entIF(unsigned long inst_type, struct pt_regs *regs) case IF_OPDEC: switch (inst) { +#ifdef CONFIG_KPROBES case BREAK_KPROBE: if (notify_die(DIE_BREAK, "kprobe", regs, 0, 0, SIGTRAP) == NOTIFY_STOP) return; case BREAK_KPROBE_SS: if (notify_die(DIE_SSTEPBP, "single_step", regs, 0, 0, SIGTRAP) == NOTIFY_STOP) return; +#endif +#ifdef CONFIG_UPROBES case UPROBE_BRK_UPROBE: if (notify_die(DIE_UPROBE, "uprobe", regs, 0, 0, SIGTRAP) == NOTIFY_STOP) - return; + return sw64_fix_uretprobe(regs); case UPROBE_BRK_UPROBE_XOL: if (notify_die(DIE_UPROBE_XOL, "uprobe_xol", regs, 0, 0, SIGTRAP) == NOTIFY_STOP) - return; + return sw64_fix_uretprobe(regs); +#endif } if (user_mode(regs)) diff --git a/arch/sw_64/kernel/uprobes.c b/arch/sw_64/kernel/uprobes.c index 786f2e38a59f831cb832840d5a27e2f50788a5c3..e25793f4a058e1763facd76f90584f62a95f1a56 100644 --- a/arch/sw_64/kernel/uprobes.c +++ b/arch/sw_64/kernel/uprobes.c @@ -4,8 +4,6 @@ #include #include -#define UPROBE_TRAP_NR ULONG_MAX - /** * arch_uprobe_analyze_insn - instruction analysis including validity and fixups. * @mm: the probed address space. @@ -54,8 +52,6 @@ int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs) /* Instruction points to execute ol */ instruction_pointer_set(regs, utask->xol_vaddr); - user_enable_single_step(current); - return 0; } @@ -66,8 +62,6 @@ int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs) /* Instruction points to execute next to breakpoint address */ instruction_pointer_set(regs, utask->vaddr + 4); - user_disable_single_step(current); - return 0; } @@ -151,3 +145,41 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) { return 0; } + +/* + * struct xol_area and get_trampoline_vaddr() are copied from + * kernel/events/uprobes.c to avoid modifying arch-independent + * code. + */ +struct xol_area { + wait_queue_head_t wq; + atomic_t slot_count; + unsigned long *bitmap; + struct vm_special_mapping xol_mapping; + struct page *pages[2]; + unsigned long vaddr; +}; + +static unsigned long get_trampoline_vaddr(void) +{ + struct xol_area *area; + unsigned long trampoline_vaddr = -1; + + area = READ_ONCE(current->mm->uprobes_state.xol_area); + if (area) + trampoline_vaddr = area->vaddr; + + return trampoline_vaddr; +} + +void sw64_fix_uretprobe(struct pt_regs *regs) +{ + unsigned long bp_vaddr; + + bp_vaddr = uprobe_get_swbp_addr(regs); + /* + * regs->pc has been changed to orig_ret_vaddr in handle_trampoline(). + */ + if (bp_vaddr == get_trampoline_vaddr()) + regs->r26 = regs->pc; +} diff --git a/arch/sw_64/kernel/vdso/vgettimeofday.c b/arch/sw_64/kernel/vdso/vgettimeofday.c index b9c9a137f9d3438d500db5f511008652e1f371d6..49bb4e2e66ed40526f6154ae4649a4c5db824235 100644 --- a/arch/sw_64/kernel/vdso/vgettimeofday.c +++ b/arch/sw_64/kernel/vdso/vgettimeofday.c @@ -16,6 +16,7 @@ #include #include +#include static __always_inline int syscall_fallback(clockid_t clkid, struct timespec64 *ts) { @@ -25,8 +26,8 @@ static __always_inline int syscall_fallback(clockid_t clkid, struct timespec64 * " mov %0, $16\n" " mov %1, $17\n" " ldi $0, %2\n" - " sys_call 0x83\n" - :: "r"(clkid), "r"(ts), "i"(__NR_clock_gettime) + " sys_call %3\n" + :: "r"(clkid), "r"(ts), "i"(__NR_clock_gettime), "i"(HMC_callsys) : "$0", "$16", "$17", "$19"); if (unlikely(r19)) return -r0; @@ -78,9 +79,7 @@ static __always_inline u64 read_longtime(void) register unsigned long __r0 __asm__("$0"); __asm__ __volatile__( - "sys_call 0xB1" - : "=r"(__r0) - ::"memory"); + "sys_call %1" : "=r"(__r0) : "i" (HMC_longtime)); return __r0; } diff --git a/arch/sw_64/kernel/vdso/vrt_sigreturn.S b/arch/sw_64/kernel/vdso/vrt_sigreturn.S index 6aa7aa300b4d119a844ea1fcd75a1985b1685573..d2d7295ffa7ac13d2c0fea96cb56b50eb72af6b3 100644 --- a/arch/sw_64/kernel/vdso/vrt_sigreturn.S +++ b/arch/sw_64/kernel/vdso/vrt_sigreturn.S @@ -19,6 +19,7 @@ #include #include +#include #define RT_SIGFRAME_SIZE 1600 #define RT_SIGFRAME_MCTX 176 @@ -64,6 +65,6 @@ ENTRY(__vdso_rt_sigreturn) mov $sp, $16 ldi $0, __NR_rt_sigreturn - sys_call 0x83 + sys_call HMC_callsys ENDPROC(__vdso_rt_sigreturn) .cfi_endproc diff --git a/arch/sw_64/kvm/Kconfig b/arch/sw_64/kvm/Kconfig index 4b6201ff5dc80bacfe731c0d3469d847caeaef62..8077ea4527654fe6e0329cd0a8942da9490f49f5 100644 --- a/arch/sw_64/kvm/Kconfig +++ b/arch/sw_64/kvm/Kconfig @@ -29,6 +29,7 @@ config KVM select KVM_VFIO select TUN select GENERIC_ALLOCATOR + select KVM_GENERIC_DIRTYLOG_READ_PROTECT help Support for hosting Guest kernels. We don't support KVM with 3-level page tables yet. diff --git a/arch/sw_64/kvm/Makefile b/arch/sw_64/kvm/Makefile index 48ae938faab7733e3f155490f3653e445bbc9068..43cea19215ffa91a6006631553cee9ce98098be9 100644 --- a/arch/sw_64/kvm/Makefile +++ b/arch/sw_64/kvm/Makefile @@ -8,6 +8,6 @@ KVM := ../../../virt/kvm ccflags-y += -Ivirt/kvm -Iarch/sw_64/kvm kvm-$(CONFIG_KVM_SW64_HOST) += $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/irqchip.o $(KVM)/vfio.o -kvm-$(CONFIG_KVM_SW64_HOST) += kvm-sw64.o entry.o emulate.o mmio.o kvm_timer.o handle_exit.o +kvm-$(CONFIG_KVM_SW64_HOST) += kvm-sw64.o entry.o emulate.o mmio.o kvm_timer.o handle_exit.o perf.o obj-$(CONFIG_KVM_SW64_HOST) += kvm.o diff --git a/arch/sw_64/kvm/handle_exit.c b/arch/sw_64/kvm/handle_exit.c index 5016bc0eddc2f86fa99f3b9e3247c7f138344e54..52f40a4c5803bf5980308b18fbfb6459ab42bdec 100644 --- a/arch/sw_64/kvm/handle_exit.c +++ b/arch/sw_64/kvm/handle_exit.c @@ -13,9 +13,18 @@ int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run, int exception_index, struct hcall_args *hargs) { + gfn_t gfn; + switch (exception_index) { case SW64_KVM_EXIT_IO: return io_mem_abort(vcpu, run, hargs); + case SW64_KVM_MIGRATION_SET_DIRTY_HM: + case SW64_KVM_MIGRATION_SET_DIRTY: + gfn = hargs->arg2 >> 24; + mutex_lock(&vcpu->kvm->slots_lock); + kvm_vcpu_mark_page_dirty(vcpu, gfn); + mutex_unlock(&vcpu->kvm->slots_lock); + return 1; case SW64_KVM_EXIT_HALT: vcpu->arch.halted = 1; kvm_vcpu_block(vcpu); diff --git a/arch/sw_64/kvm/irq.h b/arch/sw_64/kvm/irq.h index ee56d9b97632f3be9962aa832fafb32d4cc35e41..9268ab6af4920818566e2d39e056be795429d20d 100644 --- a/arch/sw_64/kvm/irq.h +++ b/arch/sw_64/kvm/irq.h @@ -3,10 +3,10 @@ * irq.h: in kernel interrupt controller related definitions */ -#ifndef __IRQ_H -#define __IRQ_H +#ifndef _SW64_KVM_IRQ_H +#define _SW64_KVM_IRQ_H static inline int irqchip_in_kernel(struct kvm *kvm) { return 1; } -#endif +#endif /* _SW64_KVM_IRQ_H */ diff --git a/arch/sw_64/kvm/kvm-sw64.c b/arch/sw_64/kvm/kvm-sw64.c index 825fe39f0494d61bb8023d72b07b4c8fb6ca74da..ffcfdee58a4877f527b9ac2f41fa8fb348f71f6d 100644 --- a/arch/sw_64/kvm/kvm-sw64.c +++ b/arch/sw_64/kvm/kvm-sw64.c @@ -16,6 +16,9 @@ #include #include +#define CREATE_TRACE_POINTS +#include "trace.h" + #include "../kernel/pci_impl.h" #include "vmem.c" @@ -34,6 +37,13 @@ extern bool bind_vcpu_enabled; #define HARDWARE_VPN_MASK ((1UL << WIDTH_HARDWARE_VPN) - 1) #define VPN_SHIFT (64 - WIDTH_HARDWARE_VPN) +static DEFINE_PER_CPU(struct kvm_vcpu *, kvm_running_vcpu); + +static void kvm_set_running_vcpu(struct kvm_vcpu *vcpu) +{ + __this_cpu_write(kvm_running_vcpu, vcpu); +} + int vcpu_interrupt_line(struct kvm_vcpu *vcpu, int number, bool level) { set_bit(number, (vcpu->arch.irqs_pending)); @@ -123,6 +133,19 @@ static void sw64_kvm_switch_vpn(struct kvm_vcpu *vcpu) } } +static void check_vcpu_requests(struct kvm_vcpu *vcpu) +{ + unsigned long vpn; + long cpu = smp_processor_id(); + + if (kvm_request_pending(vcpu)) { + if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu)) { + vpn = vcpu->arch.vpnc[cpu] & HARDWARE_VPN_MASK; + tbivpn(0, 0, vpn); + } + } +} + struct kvm_stats_debugfs_item debugfs_entries[] = { { NULL } }; @@ -167,12 +190,47 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu) return kvm_vcpu_exiting_guest_mode(vcpu) == IN_GUEST_MODE; } +/* + * kvm_mark_migration write the mark on every vcpucbs of the kvm, which tells + * the system to do migration while the mark is on, and flush all vcpu's tlbs + * at the beginning of the migration. + */ +void kvm_mark_migration(struct kvm *kvm, int mark) +{ + struct kvm_vcpu *vcpu; + int cpu; + + kvm_for_each_vcpu(cpu, vcpu, kvm) + vcpu->arch.vcb.migration_mark = mark << 2; + + kvm_flush_remote_tlbs(kvm); +} + void kvm_arch_commit_memory_region(struct kvm *kvm, const struct kvm_userspace_memory_region *mem, struct kvm_memory_slot *old, const struct kvm_memory_slot *new, enum kvm_mr_change change) { + /* + * At this point memslot has been committed and there is an + * allocated dirty_bitmap[], dirty pages will be be tracked while the + * memory slot is write protected. + */ + + /* If dirty logging has been stopped, do nothing for now. */ + if ((change != KVM_MR_DELETE) + && (old->flags & KVM_MEM_LOG_DIRTY_PAGES) + && (!(new->flags & KVM_MEM_LOG_DIRTY_PAGES))) { + kvm_mark_migration(kvm, 0); + return; + } + + /* If it's the first time dirty logging, flush all vcpu tlbs. */ + if ((change == KVM_MR_FLAGS_ONLY) + && (!(old->flags & KVM_MEM_LOG_DIRTY_PAGES)) + && (new->flags & KVM_MEM_LOG_DIRTY_PAGES)) + kvm_mark_migration(kvm, 1); } int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) @@ -183,6 +241,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) case KVM_CAP_IRQCHIP: case KVM_CAP_IOEVENTFD: case KVM_CAP_SYNC_MMU: + case KVM_CAP_IMMEDIATE_EXIT: r = 1; break; case KVM_CAP_NR_VCPUS: @@ -196,9 +255,10 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) return r; } -int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log) +void kvm_arch_mmu_enable_log_dirty_pt_masked(struct kvm *kvm, + struct kvm_memory_slot *slot, gfn_t gfn_offset, + unsigned long mask) { - return 0; } int kvm_sw64_pending_timer(struct kvm_vcpu *vcpu) @@ -462,6 +522,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) { vcpu->cpu = cpu; + kvm_set_running_vcpu(vcpu); } void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) @@ -472,6 +533,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) * optimized make_all_cpus_request path. */ vcpu->cpu = -1; + kvm_set_running_vcpu(NULL); } int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, @@ -535,6 +597,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) bool more; sigset_t sigsaved; + if (run->immediate_exit) + return -EINTR; + /* Set guest vcb */ /* vpn will update later when vcpu is running */ if (vcpu->arch.vcb.vpcr == 0) { @@ -561,6 +626,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) vcpu->arch.vcb.upcr = 0x7; } +#ifdef CONFIG_PERF_EVENTS + vcpu_load(vcpu); +#endif if (vcpu->sigset_active) sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); @@ -598,9 +666,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) vcpu->arch.halted = 0; sw64_kvm_switch_vpn(vcpu); + check_vcpu_requests(vcpu); guest_enter_irqoff(); /* Enter the guest */ + trace_kvm_sw64_entry(vcpu->vcpu_id, vcpu->arch.regs.pc); vcpu->mode = IN_GUEST_MODE; ret = __sw64_vcpu_run((struct vcpucb *)__phys_addr((unsigned long)vcb), &(vcpu->arch.regs), &hargs); @@ -610,6 +680,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) local_irq_enable(); guest_exit_irqoff(); + + trace_kvm_sw64_exit(ret, vcpu->arch.regs.pc); + preempt_enable(); /* ret = 0 indicate interrupt in guest mode, ret > 0 indicate hcall */ @@ -619,12 +692,16 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) if (vcpu->sigset_active) sigprocmask(SIG_SETMASK, &sigsaved, NULL); +#ifdef CONFIG_PERF_EVENTS + vcpu_put(vcpu); +#endif return ret; } long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { + unsigned long result; struct kvm_vcpu *vcpu = filp->private_data; struct vcpucb *kvm_vcb; @@ -632,12 +709,32 @@ long kvm_arch_vcpu_ioctl(struct file *filp, case KVM_SW64_VCPU_INIT: return kvm_arch_vcpu_reset(vcpu); case KVM_SW64_GET_VCB: + if (vcpu->arch.vcb.migration_mark) { + result = sw64_io_read(0, LONG_TIME); + vcpu->arch.vcb.guest_longtime = result; + vcpu->arch.vcb.guest_irqs_pending = vcpu->arch.irqs_pending[0]; + } + if (copy_to_user((void __user *)arg, &(vcpu->arch.vcb), sizeof(struct vcpucb))) return -EINVAL; break; case KVM_SW64_SET_VCB: kvm_vcb = memdup_user((void __user *)arg, sizeof(*kvm_vcb)); memcpy(&(vcpu->arch.vcb), kvm_vcb, sizeof(struct vcpucb)); + + if (vcpu->arch.vcb.migration_mark) { + /* updated vpcr needed by destination vm */ + vcpu->arch.vcb.vpcr + = get_vpcr(vcpu->kvm->arch.host_phys_addr, vcpu->kvm->arch.size, 0); + + result = sw64_io_read(0, LONG_TIME); + + /* synchronize the longtime of source and destination */ + vcpu->arch.vcb.guest_longtime_offset = vcpu->arch.vcb.guest_longtime - result; + + set_timer(vcpu, 200000000); + vcpu->arch.vcb.migration_mark = 0; + } break; default: return -EINVAL; @@ -667,17 +764,25 @@ long kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) int kvm_arch_init(void *opaque) { + kvm_sw64_perf_init(); return 0; } void kvm_arch_exit(void) { + kvm_sw64_perf_teardown(); } void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot) { } +void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm, + struct kvm_memory_slot *memslot) +{ + kvm_flush_remote_tlbs(kvm); +} + int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id) { return 0; diff --git a/arch/sw_64/kvm/perf.c b/arch/sw_64/kvm/perf.c new file mode 100644 index 0000000000000000000000000000000000000000..8d90d79643de025a1fd815a6eee992be6daae892 --- /dev/null +++ b/arch/sw_64/kvm/perf.c @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Performance events support for KVM. + */ + +#include +#include + +#include + +static int kvm_is_in_guest(void) +{ + return kvm_get_running_vcpu() != NULL; +} + +static int kvm_is_user_mode(void) +{ + struct kvm_vcpu *vcpu; + + vcpu = kvm_get_running_vcpu(); + + if (vcpu) + return (vcpu->arch.regs.ps & 8) != 0; + + return 0; +} + +static unsigned long kvm_get_guest_ip(void) +{ + struct kvm_vcpu *vcpu; + + vcpu = kvm_get_running_vcpu(); + + if (vcpu) + return vcpu->arch.regs.pc; + return 0; +} + +static struct perf_guest_info_callbacks kvm_guest_cbs = { + .is_in_guest = kvm_is_in_guest, + .is_user_mode = kvm_is_user_mode, + .get_guest_ip = kvm_get_guest_ip, +}; + +int kvm_sw64_perf_init(void) +{ + return perf_register_guest_info_callbacks(&kvm_guest_cbs); +} + +int kvm_sw64_perf_teardown(void) +{ + return perf_unregister_guest_info_callbacks(&kvm_guest_cbs); +} diff --git a/arch/sw_64/kvm/trace.h b/arch/sw_64/kvm/trace.h new file mode 100644 index 0000000000000000000000000000000000000000..2611df3d3fa57658881319c3384979aad2ea302c --- /dev/null +++ b/arch/sw_64/kvm/trace.h @@ -0,0 +1,62 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#if !defined(_SW64_KVM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _SW64_KVM_TRACE_H + +#include + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM kvm + +/* + * Tracepoint for guest mode entry. + */ +TRACE_EVENT(kvm_sw64_entry, + TP_PROTO(unsigned int vcpu_id, unsigned int vcpu_pc), + TP_ARGS(vcpu_id, vcpu_pc), + + TP_STRUCT__entry( + __field(unsigned int, vcpu_id) + __field(unsigned int, vcpu_pc) + ), + + TP_fast_assign( + __entry->vcpu_id = vcpu_id; + __entry->vcpu_pc = vcpu_pc; + ), + + TP_printk("VCPU %u: PC: 0x%08x", __entry->vcpu_id, __entry->vcpu_pc) +); + +/* + * Tracepoint for guest mode exit. + */ + +TRACE_EVENT(kvm_sw64_exit, + TP_PROTO(unsigned int exit_reason, unsigned long vcpu_pc), + TP_ARGS(exit_reason, vcpu_pc), + + TP_STRUCT__entry( + __field(unsigned int, exit_reason) + __field(unsigned long, vcpu_pc) + ), + + TP_fast_assign( + __entry->exit_reason = exit_reason; + __entry->vcpu_pc = vcpu_pc; + ), + + TP_printk("exit_reason: 0x%04x (%11s), PC: 0x%08lx", + __entry->exit_reason, + __print_symbolic(__entry->exit_reason, kvm_sw64_exception_type), + __entry->vcpu_pc) +); + +#endif /* _SW64_KVM_TRACE_H */ + +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH . +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_FILE trace + +/* This part must be outside protection */ +#include diff --git a/arch/sw_64/lib/Kconfig b/arch/sw_64/lib/Kconfig index d1e9cdd3947a8e5a48d75df80b4f8bcaaf4cc72e..e22751a457ceb1053fddd5411f90cf14d02af20a 100644 --- a/arch/sw_64/lib/Kconfig +++ b/arch/sw_64/lib/Kconfig @@ -8,6 +8,13 @@ config DEEP_CLEAR_PAGE This option enables the use of SIMD version of clear page routine. Say N if you want to use the generic version. +config DEEP_CLEAR_USER + bool "Clear User with SIMD optimization" + default y + help + This option enables the use of SIMD version of clear user routine. + Say N if you want to use the generic version. + config DEEP_COPY_PAGE bool "Copy Page with SIMD optimization" default y diff --git a/arch/sw_64/lib/Makefile b/arch/sw_64/lib/Makefile index bb2e9b52fedc00ce449752fd3533ea8a67bffea1..e4727dce3655074f5d18e5aeb69f1d34afa37f14 100644 --- a/arch/sw_64/lib/Makefile +++ b/arch/sw_64/lib/Makefile @@ -11,7 +11,6 @@ lib-y = __divlu.o __remlu.o __divwu.o __remwu.o \ memmove.o \ checksum.o \ csum_partial_copy.o \ - clear_user.o \ fpreg.o \ strcpy.o \ strncpy.o \ @@ -21,6 +20,9 @@ lib-y = __divlu.o __remlu.o __divwu.o __remwu.o \ lib-clear_page-y := clear_page.o lib-clear_page-$(CONFIG_DEEP_CLEAR_PAGE) := deep-clear_page.o +lib-clear_user-y := clear_user.o +lib-clear_user-$(CONFIG_DEEP_CLEAR_USER) := deep-clear_user.o + lib-copy_page-y := copy_page.o lib-copy_page-$(CONFIG_DEEP_COPY_PAGE) := deep-copy_page.o @@ -33,7 +35,7 @@ lib-memcpy-$(CONFIG_DEEP_MEMCPY) := deep-memcpy.o lib-memset-y := memset.o lib-memset-$(CONFIG_DEEP_MEMSET) := deep-memset.o -lib-y += $(lib-clear_page-y) $(lib-copy_page-y) $(lib-copy_user-y) $(lib-memcpy-y) $(lib-memset-y) +lib-y += $(lib-clear_page-y) $(lib-clear_user-y) $(lib-copy_page-y) $(lib-copy_user-y) $(lib-memcpy-y) $(lib-memset-y) obj-y = iomap.o obj-y += iomap_copy.o diff --git a/arch/sw_64/lib/clear_user.S b/arch/sw_64/lib/clear_user.S index 88d332032c9d475a636d06df827042c23b459e3f..5ac77fc8ca0d70adc59b232126c614b64e688a31 100644 --- a/arch/sw_64/lib/clear_user.S +++ b/arch/sw_64/lib/clear_user.S @@ -27,6 +27,38 @@ .ent __clear_user .frame $30, 0, $26 .prologue 0 +__clear_user: + and $17, $17, $0 + and $16, 7, $4 + beq $0, $zerolength + addl $0, $4, $1 + and $1, 7, $2 + srl $1, 3, $1 + beq $4, $loop + + subl $4, 8, $4 + addl $0, $4, $0 + beq $1, $oneword + +$head: + EX(stb $31, 0($16)) + addl $16, 1, $16 + addl $4, 1, $4 + bne $4, $head + subl $1, 1, $1 + br $loop + unop + +$oneword: + EX(stb $31, 0($16)) + addl $16, 1, $16 + addl $4, 1, $4 + bne $4, $oneword + clr $0 + +$zerolength: +$exception: + ret $31, ($26), 1 $loop: and $1, 3, $4 @@ -66,37 +98,5 @@ $tail: clr $0 ret $31, ($26), 1 -__clear_user: - and $17, $17, $0 - and $16, 7, $4 - beq $0, $zerolength - addl $0, $4, $1 - and $1, 7, $2 - srl $1, 3, $1 - beq $4, $loop - - subl $4, 8, $4 - addl $0, $4, $0 - beq $1, $oneword - -$head: - EX(stb $31, 0($16)) - addl $16, 1, $16 - addl $4, 1, $4 - bne $4, $head - subl $1, 1, $1 - br $loop - unop - -$oneword: - EX(stb $31, 0($16)) - addl $16, 1, $16 - addl $4, 1, $4 - bne $4, $oneword - clr $0 - -$zerolength: -$exception: - ret $31, ($26), 1 .end __clear_user EXPORT_SYMBOL(__clear_user) diff --git a/arch/sw_64/lib/deep-clear_user.S b/arch/sw_64/lib/deep-clear_user.S new file mode 100644 index 0000000000000000000000000000000000000000..521586a7189fe433e62b8ced61974b2659324f39 --- /dev/null +++ b/arch/sw_64/lib/deep-clear_user.S @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Contributed by Mao Minkai + * + * Zero user space, handling exceptions as we go. + * + * We have to make sure that $0 is always up-to-date and contains the + * right "bytes left to zero" value (and that it is updated only _after_ + * a successful copy). There is also some rather minor exception setup + * stuff. + * + */ +#include +/* Allow an exception for an insn; exit if we get one. */ +#define FIXUP_LDST(x,y...) \ + 99: x,##y; \ + .section __ex_table,"a"; \ + .long 99b - .; \ + ldi $31, $out-99b($31); \ + .previous + +/* + * $7: SIMD status + * 0: not in simd loop + * 1: in simd loop + * 2: in simd_u loop + * $18: bytes left to copy + * + */ + .globl __clear_user + .ent __clear_user +__clear_user: + .prologue 0 + bis $31, $31, $7 + mov $17, $18 + bis $31, $31, $17 +#include "deep-set_template.S" +$out: + bis $31, $18, $0 + beq $7, $return + +$restore_simd: + RESTORE_SIMD_REGS + +$return: + ret + .end __clear_user + EXPORT_SYMBOL(__clear_user) diff --git a/arch/sw_64/lib/deep-memset.S b/arch/sw_64/lib/deep-memset.S index 7fbd529c72a84f842f59284399f3089e644b4c79..5d9beb1e2f539261e7ec72d725dc06cc0aa42098 100644 --- a/arch/sw_64/lib/deep-memset.S +++ b/arch/sw_64/lib/deep-memset.S @@ -27,7 +27,8 @@ #include -#define NC_STORE_THRESHOLD 2048 +#define FIXUP_LDST(x, y) \ + x, y .set noat .set noreorder @@ -53,94 +54,9 @@ ___memset: bis $17, $4, $17 __constant_c_memset: - bis $31, $16, $0 # set return value - beq $18, $out # return if size is 0 - cmplt $18, 8, $5 # size less than 8, do 1-byte loop - bne $5, $tail_loop - -/* loop until SRC is 8 bytes aligned */ - .align 5 -$head_loop: - and $16, 0x7, $1 - beq $1, $mod8_aligned - stb $17, 0($16) - subl $18, 1, $18 - beq $18, $out - addl $16, 1, $16 - br $31, $head_loop - -$mod8_aligned: - -/* set 8 bytes each time */ - .align 5 -$mod8_loop: - and $16, 0x1f, $1 - beq $1, $mod32_aligned - subl $18, 8, $18 - blt $18, $tail - stl $17, 0($16) - addl $16, 8, $16 - br $31, $mod8_loop - -/* expand data to 32 bytes */ -$mod32_aligned: - subl $sp, 64, $sp - addl $sp, 31, $4 - bic $4, 0x1f, $4 - vstd $f10, 0($4) - ifmovd $17, $f10 - vcpyf $f10, $f10 - - ldi $1, NC_STORE_THRESHOLD($31) - cmple $18, $1, $1 - bne $1, $mod32_loop - -/* set 64 bytes each time */ - .align 5 -$mod32_loop_nc: - subl $18, 64, $18 - blt $18, $mod32_tail_memb - vstd_nc $f10, 0($16) - vstd_nc $f10, 32($16) - addl $16, 64, $16 - br $31, $mod32_loop_nc - - .align 5 -$mod32_loop: - subl $18, 64, $18 - blt $18, $mod32_tail - vstd $f10, 0($16) - vstd $f10, 32($16) - addl $16, 64, $16 - br $31, $mod32_loop - -$mod32_tail_memb: - memb # required for _nc store instructions -$mod32_tail: - vldd $f10, 0($4) - addl $sp, 64, $sp - addl $18, 64, $18 - .align 5 -$mod32_tail_loop: - subl $18, 8, $18 - blt $18, $tail - stl $17, 0($16) - addl $16, 8, $16 - br $31, $mod32_tail_loop - -$tail: - addl $18, 8, $18 - -/* set one byte each time */ - .align 5 -$tail_loop: - beq $18, $out - stb $17, 0($16) - subl $18, 1, $18 - addl $16, 1, $16 - br $31, $tail_loop - -/* done, return */ + bis $31, $31, $7 + bis $31, $16, $0 +#include "deep-set_template.S" $out: ret diff --git a/arch/sw_64/lib/deep-set_template.S b/arch/sw_64/lib/deep-set_template.S new file mode 100644 index 0000000000000000000000000000000000000000..f9073d638468dbb77d991ddbbc276f2f57c865ff --- /dev/null +++ b/arch/sw_64/lib/deep-set_template.S @@ -0,0 +1,133 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* + * template for memcpy and copy_user with SIMD + * + * $7: SIMD status + * 0: not in simd loop + * 1: in simd loop + * 2: in simd_u loop + * $16: latest dest, clobbered + * $17: 8-byte data to set + * $18: bytes left to copy + * + */ + +#define NC_STORE_THRESHOLD 2048 + +#define SAVE_SIMD_REGS \ + ldi $sp, -0x40($sp); \ + addl $sp, 0x1f, $23; \ + bic $23, 0x1f, $23; \ + vstd $f1, 0($23); \ + ldi $7, 1 + +#define RESTORE_SIMD_REGS \ + vldd $f1, 0($23); \ + ldi $sp, 0x40($sp); \ + bis $31, $31, $7 + + ble $18, $out + and $16, 7, $1 + beq $1, $dest_aligned_8 + + .align 3 +$byte_loop_head: + FIXUP_LDST( stb $17, 0($16) ) + subl $18, 1, $18 + addl $16, 1, $16 + ble $18, $out + and $16, 7, $1 + bne $1, $byte_loop_head + +$dest_aligned_8: + cmplt $18, 16, $1 + bne $1, $quad_loop_end + and $16, 31, $1 + beq $1, $dest_aligned_32 + cmplt $18, 64, $1 + bne $1, $simd_end + + .align 3 +$quad_loop_head: + FIXUP_LDST( stl $17, 0($16) ) + addl $16, 8, $16 + subl $18, 8, $18 + and $16, 31, $1 + beq $1, $dest_aligned_32 + br $31, $quad_loop_head + +$dest_aligned_32: + cmplt $18, 64, $1 + bne $1, $simd_end + +$prep_simd_loop: + SAVE_SIMD_REGS + ifmovd $17, $f1 + vcpyf $f1, $f1 + ldi $1, NC_STORE_THRESHOLD($31) + cmple $18, $1, $1 + bne $1, $simd_loop + + .align 3 +$simd_loop_nc: + FIXUP_LDST( vstd_nc $f1, 0($16) ) + FIXUP_LDST( vstd_nc $f1, 32($16) ) + subl $18, 64, $18 + addl $16, 64, $16 + cmplt $18, 64, $1 + beq $1, $simd_loop_nc + memb # required for _nc store instructions + br $31, $simd_loop_end + + .align 3 +$simd_loop: + FIXUP_LDST( vstd $f1, 0($16) ) + FIXUP_LDST( vstd $f1, 32($16) ) + subl $18, 64, $18 + addl $16, 64, $16 + cmplt $18, 64, $1 + beq $1, $simd_loop + +$simd_loop_end: + cmplt $18, 32, $1 + bne $1, $no_more_simd + FIXUP_LDST( vstd $f1, 0($16) ) + subl $18, 32, $18 + addl $16, 32, $16 + +$no_more_simd: + RESTORE_SIMD_REGS + +$simd_end: + ble $18, $out + cmplt $18, 16, $1 + bne $1, $quad_loop_end + + .align 3 +$quad_loop_tail: + FIXUP_LDST( stl $17, 0($16) ) + FIXUP_LDST( stl $17, 8($16) ) + subl $18, 16, $18 + addl $16, 16, $16 + cmplt $18, 16, $1 + beq $1, $quad_loop_tail + +$quad_loop_end: + ble $18, $out + cmplt $18, 8, $1 + bne $1, $byte_loop_tail + +$move_one_quad: + FIXUP_LDST( stl $17, 0($16) ) + subl $18, 8, $18 + addl $16, 8, $16 + ble $18, $out + + .align 3 +$byte_loop_tail: + FIXUP_LDST( stb $17, 0($16) ) + subl $18, 1, $18 + addl $16, 1, $16 + bgt $18, $byte_loop_tail + br $31, $out diff --git a/arch/sw_64/math-emu/math.c b/arch/sw_64/math-emu/math.c index 9f281d82ad83cc76632901f9f2f96aaac7a17b47..6da3aadcff88dffb2498ed7beb39fb6fb04b390b 100644 --- a/arch/sw_64/math-emu/math.c +++ b/arch/sw_64/math-emu/math.c @@ -188,14 +188,14 @@ void write_fp_reg_s(unsigned long reg, unsigned long val_p0, unsigned long p1, unsigned long p2, unsigned long p3); void write_fp_reg_d(unsigned long reg, unsigned long val_p0, unsigned long p1, unsigned long p2, unsigned long p3); -#define LOW_64_WORKING 1 +#define LOW_64_WORKING 1 #define HIGH_64_WORKING 2 /* * End for sw64 */ -#define OPC_HMC 0x00 +#define OPC_HMC 0x00 #define OPC_INTA 0x10 #define OPC_INTL 0x11 #define OPC_INTS 0x12 @@ -205,7 +205,7 @@ void write_fp_reg_d(unsigned long reg, unsigned long val_p0, #define OPC_FLTI 0x16 #define OPC_FLTL 0x17 #define OPC_MISC 0x18 -#define OPC_JSR 0x1a +#define OPC_JSR 0x1a #define FOP_SRC_S 0 #define FOP_SRC_T 2 @@ -295,9 +295,9 @@ void cleanup_module(void) sw64_fp_emul = save_emul; } -#undef sw64_fp_emul_imprecise +#undef sw64_fp_emul_imprecise #define sw64_fp_emul_imprecise do_sw_fp_emul_imprecise -#undef sw64_fp_emul +#undef sw64_fp_emul #define sw64_fp_emul do_sw_fp_emul #endif /* MODULE */ diff --git a/arch/sw_64/math-emu/sfp-util.h b/arch/sw_64/math-emu/sfp-util.h index 63f9685999f3df9cd34edc1e0a300d74b4fec494..0769c0223e0d7e43e0b73fbd45882333e95f765f 100644 --- a/arch/sw_64/math-emu/sfp-util.h +++ b/arch/sw_64/math-emu/sfp-util.h @@ -1,4 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _SW64_MATH_EMU_SFP_UTIL_H +#define _SW64_MATH_EMU_SFP_UTIL_H + #include #include #include @@ -34,3 +37,5 @@ extern unsigned long __udiv_qrnnd(unsigned long *, unsigned long, #define __LITTLE_ENDIAN -1 #endif #define __BYTE_ORDER __LITTLE_ENDIAN + +#endif /* _SW64_MATH_EMU_SFP_UTIL_H */ diff --git a/arch/sw_64/net/bpf_jit.h b/arch/sw_64/net/bpf_jit.h index 2cf5ba5253a84dd34f87e420a59a8d999584d783..929036d8ea6b10daec13166c1e87f63165d99f1a 100644 --- a/arch/sw_64/net/bpf_jit.h +++ b/arch/sw_64/net/bpf_jit.h @@ -18,8 +18,8 @@ * along with this program. If not, see . */ -#ifndef _SW64_BPF_JIT_H -#define _SW64_BPF_JIT_H +#ifndef _SW64_NET_BPF_JIT_H +#define _SW64_NET_BPF_JIT_H /* SW64 instruction field shift */ #define SW64_BPF_OPCODE_OFFSET 26 @@ -365,4 +365,4 @@ enum sw64_bpf_registers { sw64_bpf_gen_format_simple_alu_imm(SW64_BPF_OPCODE_ALU_IMM, \ ra, imm8, dst, SW64_BPF_FUNC_ALU_CMPULE) -#endif /* _SW64_BPF_JIT_H */ +#endif /* _SW64_NET_BPF_JIT_H */ diff --git a/arch/sw_64/oprofile/op_impl.h b/arch/sw_64/oprofile/op_impl.h index 10bdd455c3dde7c259e424606420c991b08ad86f..e8714cb7c2ea773b8c270bd4f9cfee7c3c8286db 100644 --- a/arch/sw_64/oprofile/op_impl.h +++ b/arch/sw_64/oprofile/op_impl.h @@ -53,4 +53,4 @@ struct op_axp_model { unsigned char can_set_proc_mode; }; -#endif +#endif /* _SW64_OPROFILE_OP_IMPL_H */ diff --git a/arch/sw_64/tools/relocs.c b/arch/sw_64/tools/relocs.c index a8a9e08a0a658b6347f9f6c01dce883746b7fb1e..06bd4625bc6e0c57c5eb4fc6566bfdc884d81a69 100644 --- a/arch/sw_64/tools/relocs.c +++ b/arch/sw_64/tools/relocs.c @@ -487,6 +487,7 @@ static int do_reloc(struct section *sec, Elf_Rel *rel, Elf_Sym *sym, case R_SW64_SREL32: case R_SW64_GPRELHIGH: case R_SW64_GPRELLOW: + case R_SW64_LITERAL_GOT: /* * NONE can be ignored and PC relative relocations don't * need to be adjusted. diff --git a/arch/sw_64/tools/relocs.h b/arch/sw_64/tools/relocs.h index 7273ccaed11fee146d4d5ba695fb39791d266740..17c7e31113a0e5f93ac2b596d54e31bc9de7fe58 100644 --- a/arch/sw_64/tools/relocs.h +++ b/arch/sw_64/tools/relocs.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#ifndef RELOCS_H -#define RELOCS_H +#ifndef _SW64_TOOLS_RELOCS_H +#define _SW64_TOOLS_RELOCS_H #include #include @@ -53,6 +53,7 @@ #define R_SW64_TPRELHI 39 #define R_SW64_TPRELLO 40 #define R_SW64_TPREL16 41 +#define R_SW64_LITERAL_GOT 43 /* GP relative */ void die(char *fmt, ...); @@ -68,4 +69,4 @@ enum symtype { void process(FILE *fp, int as_text, int as_bin, int show_reloc_info, int keep_relocs); -#endif /* RELOCS_H */ +#endif /* _SW64_TOOLS_RELOCS_H */