提交 fc453d57 编写于 作者: M Mao Minkai 提交者: guzitao

sw64: adjust make rules to avoid compile error

Sunway inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I56OLG

--------------------------------

Fix compile errors when CONFIG_NUMA or CONFIG_SPARSEMEM is not set.
Some make rules are changed to avoid potential compile errors.
Signed-off-by: NMao Minkai <maominkai@wxiat.com>
Signed-off-by: NGu Zitao <guzitao@wxiat.com>
上级 5841266c
......@@ -97,6 +97,7 @@ config SW64
select HAVE_REGS_AND_STACK_ACCESS_API
select ARCH_HAS_PTE_SPECIAL
select HARDIRQS_SW_RESEND
select MEMORY_HOTPLUG_SPARSE if MEMORY_HOTPLUG
config LOCKDEP_SUPPORT
def_bool y
......
......@@ -31,9 +31,13 @@ obj-$(CONFIG_HIBERNATION) += hibernate_asm.o hibernate.o
obj-$(CONFIG_AUDIT) += audit.o
obj-$(CONFIG_PCI) += pci_common.o
obj-$(CONFIG_RELOCATABLE) += relocate.o
obj-$(CONFIG_DEBUG_FS) += segvdbg.o bindvcpu.o
obj-$(CONFIG_DEBUG_FS) += segvdbg.o
obj-$(CONFIG_JUMP_LABEL) += jump_label.o
ifeq ($(CONFIG_DEBUG_FS)$(CONFIG_NUMA),yy)
obj-y += bindvcpu.o
endif
ifndef CONFIG_PCI
obj-y += pci-noop.o
endif
......
......@@ -44,7 +44,7 @@ config KVM_SW64_HOST
config KVM_MEMHOTPLUG
bool "Memory hotplug support for guest"
depends on KVM
depends on KVM && MEMORY_HOTPLUG
help
Provides memory hotplug support for SW64 guest.
......
......@@ -21,7 +21,9 @@
bool set_msi_flag;
unsigned long sw64_kvm_last_vpn[NR_CPUS];
#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_NUMA)
__read_mostly bool bind_vcpu_enabled;
#endif
#define cpu_last_vpn(cpuid) sw64_kvm_last_vpn[cpuid]
#ifdef CONFIG_SUBARCH_C3B
......@@ -539,6 +541,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
vcpu->arch.vcb.vpcr
= get_vpcr(vcpu->kvm->arch.host_phys_addr, vcpu->kvm->arch.size, 0);
#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_NUMA)
if (unlikely(bind_vcpu_enabled)) {
int nid;
unsigned long end;
......@@ -548,11 +551,12 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
if (pfn_to_nid(PHYS_PFN(end)) == nid)
set_cpus_allowed_ptr(vcpu->arch.tsk, node_to_cpumask_map[nid]);
}
#else
#endif
#else /* !CONFIG_KVM_MEMHOTPLUG */
unsigned long seg_base = virt_to_phys(vcpu->kvm->arch.seg_pgd);
vcpu->arch.vcb.vpcr = get_vpcr_memhp(seg_base, 0);
#endif
#endif /* CONFIG_KVM_MEMHOTPLUG */
vcpu->arch.vcb.upcr = 0x7;
}
......
......@@ -34,6 +34,7 @@ static pud_t vmalloc_pud[1024] __attribute__((__aligned__(PAGE_SIZE)));
static phys_addr_t mem_start;
static phys_addr_t mem_size_limit;
#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
unsigned long memory_block_size_bytes(void)
{
if (is_in_guest())
......@@ -41,6 +42,7 @@ unsigned long memory_block_size_bytes(void)
else
return MIN_MEMORY_BLOCK_SIZE;
}
#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
static int __init setup_mem_size(char *p)
{
......
// SPDX-License-Identifier: GPL-2.0
#include <linux/mmdebug.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <asm/page.h>
unsigned long __phys_addr(unsigned long x)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册