Skip to contentSkip to conversation

xen/x86: Fixup misc stale issues

PATCH In review Andrew Cooper 5 participants 8 messages Oct 14, 2016 – Oct 24, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 xen/x86: Fixup misc stale issues

* Dom0 does now have an arch_config passed.
* hypercall() and smp_alloc_memory() no longer exist.

---
CC: Jan Beulich <[email protected]>

---
 xen/arch/x86/setup.c            | 6 +-----
 xen/include/asm-x86/processor.h | 2 --
 xen/include/asm-x86/smp.h       | 2 --
 3 files changed, 1 insertion(+), 9 deletions(-)
xen/arch/x86/setup.c +1 -5
index 8ae897a..41f9a5b 100644
@@ -1493,11 +1493,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     if ( opt_dom0pvh )
         domcr_flags |= DOMCRF_pvh | DOMCRF_hap;
 
-    /*
-     * Create initial domain 0.
-     * x86 doesn't support arch-configuration. So it's fine to pass
-     * NULL.
-     */
+    /* Create initial domain 0. */
     dom0 = domain_create(0, domcr_flags, 0, &config);
     if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
         panic("Error creating domain 0");
xen/include/asm-x86/processor.h +0 -2
index 3e6e355..6378afd 100644
@@ -612,8 +612,6 @@ struct stubs {
 DECLARE_PER_CPU(struct stubs, stubs);
 unsigned long alloc_stub_page(unsigned int cpu, unsigned long *mfn);
 
-extern int hypercall(void);
-
 int cpuid_hypervisor_leaves( uint32_t idx, uint32_t sub_idx,
           uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx);
 int rdmsr_hypervisor_regs(uint32_t idx, uint64_t *val);
xen/include/asm-x86/smp.h +0 -2
index 33c2c32..e3782bb 100644
@@ -23,8 +23,6 @@
 /*
  * Private routines/data
  */
- 
-extern void smp_alloc_memory(void);
 DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
 DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

PATCH 2/3 x86/mm: Use IS_ALIGNED() rather than open coding it

Drop repeated identical BUILD_BUG_ON()'s

---
CC: Jan Beulich <[email protected]>
CC: George Dunlap <[email protected]>

---
 xen/arch/x86/x86_64/mm.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
xen/arch/x86/x86_64/mm.c +5 -7
index b8b6b70..0083beb 100644
@@ -540,7 +540,7 @@ void __init paging_init(void)
                  sizeof(*machine_to_phys_mapping));
     for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
     {
-        BUILD_BUG_ON(RO_MPT_VIRT_START & ((1UL << L3_PAGETABLE_SHIFT) - 1));
+        BUILD_BUG_ON(!IS_ALIGNED(RO_MPT_VIRT_START, L3_PAGETABLE_SHIFT));
         va = RO_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT);
         memflags = MEMF_node(phys_to_nid(i <<
             (L2_PAGETABLE_SHIFT - 3 + PAGE_SHIFT)));
@@ -776,8 +776,8 @@ static int setup_frametable_chunk(void *start, void *end,
     unsigned long mfn;
     int err;
 
-    ASSERT(!(s & ((1 << L2_PAGETABLE_SHIFT) - 1)));
-    ASSERT(!(e & ((1 << L2_PAGETABLE_SHIFT) - 1)));
+    ASSERT(IS_ALIGNED(s, L2_PAGETABLE_SHIFT));
+    ASSERT(IS_ALIGNED(e, L2_PAGETABLE_SHIFT));
 
     for ( ; s < e; s += (1UL << L2_PAGETABLE_SHIFT))
     {
@@ -838,8 +838,8 @@ void __init subarch_init_memory(void)
     l3_pgentry_t l3e;
     l2_pgentry_t l2e;
 
-    BUILD_BUG_ON(RDWR_MPT_VIRT_START & ((1UL << L3_PAGETABLE_SHIFT) - 1));
-    BUILD_BUG_ON(RDWR_MPT_VIRT_END   & ((1UL << L3_PAGETABLE_SHIFT) - 1));
+    BUILD_BUG_ON(!IS_ALIGNED(RDWR_MPT_VIRT_START, L3_PAGETABLE_SHIFT));
+    BUILD_BUG_ON(!IS_ALIGNED(RDWR_MPT_VIRT_END,   L3_PAGETABLE_SHIFT));
     /* M2P table is mappable read-only by privileged domains. */
     for ( v  = RDWR_MPT_VIRT_START;
           v != RDWR_MPT_VIRT_END;
@@ -934,8 +934,6 @@ long subarch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( copy_from_guest(&xmml, arg, 1) )
             return -EFAULT;
 
-        BUILD_BUG_ON(RDWR_MPT_VIRT_START & ((1UL << L3_PAGETABLE_SHIFT) - 1));
-        BUILD_BUG_ON(RDWR_MPT_VIRT_END   & ((1UL << L3_PAGETABLE_SHIFT) - 1));
         for ( i = 0, v = RDWR_MPT_VIRT_START, last_mfn = 0;
               (i != xmml.max_extents) &&
               (v < (unsigned long)(machine_to_phys_mapping + max_page));
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#4 lore raw

PATCH 3/3 x86/svm: Drop adjustment of X86_FEATURE_APIC

In reply to Andrew Cooper

The common hvm_cpuid() code already does this.

---
CC: Jan Beulich <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>

---
 xen/arch/x86/hvm/svm/svm.c | 5 -----
 1 file changed, 5 deletions(-)
xen/arch/x86/hvm/svm/svm.c +0 -5
index 0ed3e73..16427f6 100644
@@ -1572,11 +1572,6 @@ static void svm_cpuid_intercept(
     hvm_cpuid(input, eax, ebx, ecx, edx);
 
     switch (input) {
-    case 0x80000001:
-        /* Fix up VLAPIC details. */
-        if ( vlapic_hw_disabled(vcpu_vlapic(v)) )
-            __clear_bit(X86_FEATURE_APIC & 31, edx);
-        break;
     case 0x8000001c: 
     {
         /* LWP capability CPUID */
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 3/3
#5 lore raw

Re: [PATCH 3/3] x86/svm: Drop adjustment of X86_FEATURE_APIC

Quoted 7 lines · Andrew Cooper

The common hvm_cpuid() code already does this.

---
CC: Jan Beulich <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw

Re: [PATCH 2/3] x86/mm: Use IS_ALIGNED() rather than open coding it

In reply to Andrew Cooper
Quoted 15 lines · Andrew Cooper

Drop repeated identical BUILD_BUG_ON()'s

---
CC: Jan Beulich <[email protected]>
CC: George Dunlap <[email protected]>

---
 xen/arch/x86/x86_64/mm.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
xen/arch/x86/x86_64/mm.c +0 -0
index b8b6b70..0083beb 100644

xen/arch/x86/x86_64/mm.c void __init paging_init(void) · line 543

Quoted 5 lines
xen/arch/x86/x86_64/mm.c +1 -1
@@ -540,7 +540,7 @@ void __init paging_init(void)
                  sizeof(*machine_to_phys_mapping));
     for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
     {
-        BUILD_BUG_ON(RO_MPT_VIRT_START & ((1UL << L3_PAGETABLE_SHIFT) - 1));
+        BUILD_BUG_ON(!IS_ALIGNED(RO_MPT_VIRT_START, L3_PAGETABLE_SHIFT));

This doesn't look right. This is what I have for IS_ALIGNED (in xen/include/xen/config.h):

#define IS_ALIGNED(val, align) (((val) & ((align) - 1)) == 0)

There's no shift in the #define, but you've taken it out of the calling code.

Did I miss something?

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

Re: [PATCH 2/3] x86/mm: Use IS_ALIGNED() rather than open coding it

Quoted 24 lines · George Dunlap
Quoted 15 lines · Andrew Cooper

Drop repeated identical BUILD_BUG_ON()'s

---
CC: Jan Beulich <[email protected]>
CC: George Dunlap <[email protected]>

---
 xen/arch/x86/x86_64/mm.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
xen/arch/x86/x86_64/mm.c +0 -0
index b8b6b70..0083beb 100644

xen/arch/x86/x86_64/mm.c void __init paging_init(void) · line 543

Quoted 5 lines
xen/arch/x86/x86_64/mm.c +1 -1
@@ -540,7 +540,7 @@ void __init paging_init(void)
                  sizeof(*machine_to_phys_mapping));
     for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
     {
-        BUILD_BUG_ON(RO_MPT_VIRT_START & ((1UL << L3_PAGETABLE_SHIFT) - 1));
+        BUILD_BUG_ON(!IS_ALIGNED(RO_MPT_VIRT_START, L3_PAGETABLE_SHIFT));

This doesn't look right. This is what I have for IS_ALIGNED (in xen/include/xen/config.h):

Quoted 6 lines

#define IS_ALIGNED(val, align) (((val) & ((align) - 1)) == 0)

There's no shift in the #define, but you've taken it out of the calling code.

Did I miss something?

No. I did. Sorry for the noise.

This was originally part of a larger series, which I thought I had cherrypicked out correctly but clearly haven't.

I will drop it for now.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw
Quoted 7 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 14.10.16 at 18:02, <[email protected]> wrote:

* Dom0 does now have an arch_config passed.
* hypercall() and smp_alloc_memory() no longer exist.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel