xen: fixes and cleanups for 4.19-rc1, second round

-----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQRTLbB6QfY48x44uB6AXGG7T9hjvgUCW36rRgAKCRCAXGG7T9hj
 vkrcAQC8F+ljGO5PtYUkKcMy17vqvcq/BdetJuUVfk+G1WmLxQEAiaNiqqJGsOyJ
 Msa0HHDT31uBYGg/iq7yAWk23tcTZwE=
 =Px4D
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-4.19b-rc1b-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes and cleanups from Juergen Gross:
 "Some cleanups, some minor fixes and a fix for a bug introduced in this
  merge window hitting 32-bit PV guests"

* tag 'for-linus-4.19b-rc1b-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  x86/xen: enable early use of set_fixmap in 32-bit Xen PV guest
  xen: remove unused hypercall functions
  x86/xen: remove unused function xen_auto_xlated_memory_setup()
  xen/ACPI: don't upload Px/Cx data for disabled processors
  x86/Xen: further refine add_preferred_console() invocations
  xen/mcelog: eliminate redundant setting of interface version
  x86/Xen: mark xen_setup_gdt() __init
This commit is contained in:
Linus Torvalds 2018-08-23 14:52:23 -07:00
commit d40acad1f1
9 changed files with 30 additions and 161 deletions

View File

@ -197,17 +197,6 @@ extern struct { char _entry[32]; } hypercall_page[];
(type)__res; \ (type)__res; \
}) })
#define _hypercall5(type, name, a1, a2, a3, a4, a5) \
({ \
__HYPERCALL_DECLS; \
__HYPERCALL_5ARG(a1, a2, a3, a4, a5); \
asm volatile (__HYPERCALL \
: __HYPERCALL_5PARAM \
: __HYPERCALL_ENTRY(name) \
: __HYPERCALL_CLOBBER5); \
(type)__res; \
})
static inline long static inline long
xen_single_call(unsigned int call, xen_single_call(unsigned int call,
unsigned long a1, unsigned long a2, unsigned long a1, unsigned long a2,
@ -266,47 +255,12 @@ HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
return _hypercall2(int, set_gdt, frame_list, entries); return _hypercall2(int, set_gdt, frame_list, entries);
} }
static inline int
HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
{
return _hypercall2(int, stack_switch, ss, esp);
}
#ifdef CONFIG_X86_32
static inline int
HYPERVISOR_set_callbacks(unsigned long event_selector,
unsigned long event_address,
unsigned long failsafe_selector,
unsigned long failsafe_address)
{
return _hypercall4(int, set_callbacks,
event_selector, event_address,
failsafe_selector, failsafe_address);
}
#else /* CONFIG_X86_64 */
static inline int
HYPERVISOR_set_callbacks(unsigned long event_address,
unsigned long failsafe_address,
unsigned long syscall_address)
{
return _hypercall3(int, set_callbacks,
event_address, failsafe_address,
syscall_address);
}
#endif /* CONFIG_X86_{32,64} */
static inline int static inline int
HYPERVISOR_callback_op(int cmd, void *arg) HYPERVISOR_callback_op(int cmd, void *arg)
{ {
return _hypercall2(int, callback_op, cmd, arg); return _hypercall2(int, callback_op, cmd, arg);
} }
static inline int
HYPERVISOR_fpu_taskswitch(int set)
{
return _hypercall1(int, fpu_taskswitch, set);
}
static inline int static inline int
HYPERVISOR_sched_op(int cmd, void *arg) HYPERVISOR_sched_op(int cmd, void *arg)
{ {
@ -418,19 +372,6 @@ HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
return _hypercall3(int, grant_table_op, cmd, uop, count); return _hypercall3(int, grant_table_op, cmd, uop, count);
} }
static inline int
HYPERVISOR_update_va_mapping_otherdomain(unsigned long va, pte_t new_val,
unsigned long flags, domid_t domid)
{
if (sizeof(new_val) == sizeof(long))
return _hypercall4(int, update_va_mapping_otherdomain, va,
new_val.pte, flags, domid);
else
return _hypercall5(int, update_va_mapping_otherdomain, va,
new_val.pte, new_val.pte >> 32,
flags, domid);
}
static inline int static inline int
HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type) HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type)
{ {
@ -465,12 +406,6 @@ HYPERVISOR_suspend(unsigned long start_info_mfn)
return _hypercall3(int, sched_op, SCHEDOP_shutdown, &r, start_info_mfn); return _hypercall3(int, sched_op, SCHEDOP_shutdown, &r, start_info_mfn);
} }
static inline int
HYPERVISOR_nmi_op(unsigned long op, unsigned long arg)
{
return _hypercall2(int, nmi_op, op, arg);
}
static inline unsigned long __must_check static inline unsigned long __must_check
HYPERVISOR_hvm_op(int op, void *arg) HYPERVISOR_hvm_op(int op, void *arg)
{ {
@ -528,39 +463,6 @@ MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
trace_xen_mc_entry(mcl, sizeof(new_val) == sizeof(long) ? 3 : 4); trace_xen_mc_entry(mcl, sizeof(new_val) == sizeof(long) ? 3 : 4);
} }
static inline void
MULTI_grant_table_op(struct multicall_entry *mcl, unsigned int cmd,
void *uop, unsigned int count)
{
mcl->op = __HYPERVISOR_grant_table_op;
mcl->args[0] = cmd;
mcl->args[1] = (unsigned long)uop;
mcl->args[2] = count;
trace_xen_mc_entry(mcl, 3);
}
static inline void
MULTI_update_va_mapping_otherdomain(struct multicall_entry *mcl, unsigned long va,
pte_t new_val, unsigned long flags,
domid_t domid)
{
mcl->op = __HYPERVISOR_update_va_mapping_otherdomain;
mcl->args[0] = va;
if (sizeof(new_val) == sizeof(long)) {
mcl->args[1] = new_val.pte;
mcl->args[2] = flags;
mcl->args[3] = domid;
} else {
mcl->args[1] = new_val.pte;
mcl->args[2] = new_val.pte >> 32;
mcl->args[3] = flags;
mcl->args[4] = domid;
}
trace_xen_mc_entry(mcl, sizeof(new_val) == sizeof(long) ? 4 : 5);
}
static inline void static inline void
MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr, MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
struct desc_struct desc) struct desc_struct desc)
@ -581,16 +483,6 @@ MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
trace_xen_mc_entry(mcl, sizeof(maddr) == sizeof(long) ? 2 : 4); trace_xen_mc_entry(mcl, sizeof(maddr) == sizeof(long) ? 2 : 4);
} }
static inline void
MULTI_memory_op(struct multicall_entry *mcl, unsigned int cmd, void *arg)
{
mcl->op = __HYPERVISOR_memory_op;
mcl->args[0] = cmd;
mcl->args[1] = (unsigned long)arg;
trace_xen_mc_entry(mcl, 2);
}
static inline void static inline void
MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req, MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req,
int count, int *success_count, domid_t domid) int count, int *success_count, domid_t domid)
@ -617,16 +509,6 @@ MULTI_mmuext_op(struct multicall_entry *mcl, struct mmuext_op *op, int count,
trace_xen_mc_entry(mcl, 4); trace_xen_mc_entry(mcl, 4);
} }
static inline void
MULTI_set_gdt(struct multicall_entry *mcl, unsigned long *frames, int entries)
{
mcl->op = __HYPERVISOR_set_gdt;
mcl->args[0] = (unsigned long)frames;
mcl->args[1] = entries;
trace_xen_mc_entry(mcl, 2);
}
static inline void static inline void
MULTI_stack_switch(struct multicall_entry *mcl, MULTI_stack_switch(struct multicall_entry *mcl,
unsigned long ss, unsigned long esp) unsigned long ss, unsigned long esp)

View File

@ -99,15 +99,22 @@ __ref void *alloc_low_pages(unsigned int num)
} }
if ((pgt_buf_end + num) > pgt_buf_top || !can_use_brk_pgt) { if ((pgt_buf_end + num) > pgt_buf_top || !can_use_brk_pgt) {
unsigned long ret; unsigned long ret = 0;
if (min_pfn_mapped >= max_pfn_mapped)
panic("alloc_low_pages: ran out of memory"); if (min_pfn_mapped < max_pfn_mapped) {
ret = memblock_find_in_range(min_pfn_mapped << PAGE_SHIFT, ret = memblock_find_in_range(
min_pfn_mapped << PAGE_SHIFT,
max_pfn_mapped << PAGE_SHIFT, max_pfn_mapped << PAGE_SHIFT,
PAGE_SIZE * num , PAGE_SIZE); PAGE_SIZE * num , PAGE_SIZE);
}
if (ret)
memblock_reserve(ret, PAGE_SIZE * num);
else if (can_use_brk_pgt)
ret = __pa(extend_brk(PAGE_SIZE * num, PAGE_SIZE));
if (!ret) if (!ret)
panic("alloc_low_pages: can not alloc memory"); panic("alloc_low_pages: can not alloc memory");
memblock_reserve(ret, PAGE_SIZE * num);
pfn = ret >> PAGE_SHIFT; pfn = ret >> PAGE_SHIFT;
} else { } else {
pfn = pgt_buf_end; pfn = pgt_buf_end;

View File

@ -122,6 +122,8 @@ static void __init xen_banner(void)
static void __init xen_pv_init_platform(void) static void __init xen_pv_init_platform(void)
{ {
populate_extra_pte(fix_to_virt(FIX_PARAVIRT_BOOTMAP));
set_fixmap(FIX_PARAVIRT_BOOTMAP, xen_start_info->shared_info); set_fixmap(FIX_PARAVIRT_BOOTMAP, xen_start_info->shared_info);
HYPERVISOR_shared_info = (void *)fix_to_virt(FIX_PARAVIRT_BOOTMAP); HYPERVISOR_shared_info = (void *)fix_to_virt(FIX_PARAVIRT_BOOTMAP);
@ -1170,13 +1172,13 @@ static void __init xen_boot_params_init_edd(void)
* we do this, we have to be careful not to call any stack-protected * we do this, we have to be careful not to call any stack-protected
* function, which is most of the kernel. * function, which is most of the kernel.
*/ */
static void xen_setup_gdt(int cpu) static void __init xen_setup_gdt(int cpu)
{ {
pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry_boot; pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry_boot;
pv_cpu_ops.load_gdt = xen_load_gdt_boot; pv_cpu_ops.load_gdt = xen_load_gdt_boot;
setup_stack_canary_segment(0); setup_stack_canary_segment(cpu);
switch_to_new_gdt(0); switch_to_new_gdt(cpu);
pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry; pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry;
pv_cpu_ops.load_gdt = xen_load_gdt; pv_cpu_ops.load_gdt = xen_load_gdt;
@ -1385,8 +1387,11 @@ asmlinkage __visible void __init xen_start_kernel(void)
xen_boot_params_init_edd(); xen_boot_params_init_edd();
} }
add_preferred_console("tty", 0, NULL); if (!boot_params.screen_info.orig_video_isVGA)
add_preferred_console("tty", 0, NULL);
add_preferred_console("hvc", 0, NULL); add_preferred_console("hvc", 0, NULL);
if (boot_params.screen_info.orig_video_isVGA)
add_preferred_console("tty", 0, NULL);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
/* PCI BIOS service won't work from a PV guest. */ /* PCI BIOS service won't work from a PV guest. */

View File

@ -2171,6 +2171,8 @@ void __init xen_relocate_p2m(void)
#else /* !CONFIG_X86_64 */ #else /* !CONFIG_X86_64 */
static RESERVE_BRK_ARRAY(pmd_t, initial_kernel_pmd, PTRS_PER_PMD); static RESERVE_BRK_ARRAY(pmd_t, initial_kernel_pmd, PTRS_PER_PMD);
static RESERVE_BRK_ARRAY(pmd_t, swapper_kernel_pmd, PTRS_PER_PMD); static RESERVE_BRK_ARRAY(pmd_t, swapper_kernel_pmd, PTRS_PER_PMD);
RESERVE_BRK(fixup_kernel_pmd, PAGE_SIZE);
RESERVE_BRK(fixup_kernel_pte, PAGE_SIZE);
static void __init xen_write_cr3_init(unsigned long cr3) static void __init xen_write_cr3_init(unsigned long cr3)
{ {

View File

@ -905,37 +905,6 @@ char * __init xen_memory_setup(void)
return "Xen"; return "Xen";
} }
/*
* Machine specific memory setup for auto-translated guests.
*/
char * __init xen_auto_xlated_memory_setup(void)
{
struct xen_memory_map memmap;
int i;
int rc;
memmap.nr_entries = ARRAY_SIZE(xen_e820_table.entries);
set_xen_guest_handle(memmap.buffer, xen_e820_table.entries);
rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
if (rc < 0)
panic("No memory map (%d)\n", rc);
xen_e820_table.nr_entries = memmap.nr_entries;
e820__update_table(&xen_e820_table);
for (i = 0; i < xen_e820_table.nr_entries; i++)
e820__range_add(xen_e820_table.entries[i].addr, xen_e820_table.entries[i].size, xen_e820_table.entries[i].type);
/* Remove p2m info, it is not needed. */
xen_start_info->mfn_list = 0;
xen_start_info->first_p2m_pfn = 0;
xen_start_info->nr_p2m_frames = 0;
return "Xen";
}
/* /*
* Set the bit indicating "nosegneg" library variants should be used. * Set the bit indicating "nosegneg" library variants should be used.
* We only need to bother in pure 32-bit mode; compat 32-bit processes * We only need to bother in pure 32-bit mode; compat 32-bit processes

View File

@ -50,7 +50,6 @@ void __init xen_inv_extra_mem(void);
void __init xen_remap_memory(void); void __init xen_remap_memory(void);
phys_addr_t __init xen_find_free_area(phys_addr_t size); phys_addr_t __init xen_find_free_area(phys_addr_t size);
char * __init xen_memory_setup(void); char * __init xen_memory_setup(void);
char * xen_auto_xlated_memory_setup(void);
void __init xen_arch_setup(void); void __init xen_arch_setup(void);
void xen_enable_sysenter(void); void xen_enable_sysenter(void);
void xen_enable_syscall(void); void xen_enable_syscall(void);

View File

@ -205,6 +205,7 @@ phys_cpuid_t acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id)
return phys_id; return phys_id;
} }
EXPORT_SYMBOL_GPL(acpi_get_phys_id);
int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id) int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id)
{ {

View File

@ -288,7 +288,6 @@ static int mc_queue_handle(uint32_t flags)
int ret = 0; int ret = 0;
mc_op.cmd = XEN_MC_fetch; mc_op.cmd = XEN_MC_fetch;
mc_op.interface_version = XEN_MCA_INTERFACE_VERSION;
set_xen_guest_handle(mc_op.u.mc_fetch.data, &g_mi); set_xen_guest_handle(mc_op.u.mc_fetch.data, &g_mi);
do { do {
mc_op.u.mc_fetch.flags = flags; mc_op.u.mc_fetch.flags = flags;
@ -358,7 +357,6 @@ static int bind_virq_for_mce(void)
/* Fetch physical CPU Numbers */ /* Fetch physical CPU Numbers */
mc_op.cmd = XEN_MC_physcpuinfo; mc_op.cmd = XEN_MC_physcpuinfo;
mc_op.interface_version = XEN_MCA_INTERFACE_VERSION;
set_xen_guest_handle(mc_op.u.mc_physcpuinfo.info, g_physinfo); set_xen_guest_handle(mc_op.u.mc_physcpuinfo.info, g_physinfo);
ret = HYPERVISOR_mca(&mc_op); ret = HYPERVISOR_mca(&mc_op);
if (ret) { if (ret) {

View File

@ -362,6 +362,12 @@ read_acpi_id(acpi_handle handle, u32 lvl, void *context, void **rv)
default: default:
return AE_OK; return AE_OK;
} }
if (invalid_phys_cpuid(acpi_get_phys_id(handle,
acpi_type == ACPI_TYPE_DEVICE,
acpi_id))) {
pr_debug("CPU with ACPI ID %u is unavailable\n", acpi_id);
return AE_OK;
}
/* There are more ACPI Processor objects than in x2APIC or MADT. /* There are more ACPI Processor objects than in x2APIC or MADT.
* This can happen with incorrect ACPI SSDT declerations. */ * This can happen with incorrect ACPI SSDT declerations. */
if (acpi_id >= nr_acpi_bits) { if (acpi_id >= nr_acpi_bits) {