Skip to contentSkip to conversation

ARM: Slim down dummy.S

PATCH Superseded Ian Campbell 5 participants 29 messages Jan 20, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ARM: Slim down dummy.S

Defines a few stubs and disables some as yet unsupported core features.

Early on there's a couple of unrelated cleanups.

Patch against v5 posting (Stefano's arm-v5 branch) + David Vrables zImage series.

Ian.

#1 lore raw

PATCH 1/12 arm: add a missing local-vars comment

---
 xen/arch/arm/kernel.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
xen/arch/arm/kernel.c +9 -0
index d4ffa4f..a1bcdbf 100644
@@ -190,3 +190,12 @@ void kernel_load(struct kernel_info *info)
 {
     info->load(info);
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
Signature · 1 line
1.7.2.5
#2 lore raw

PATCH 2/12 arm: define some more cp15 registers

In reply to Ian Campbell

Complete the set of cache flush and add processor feature registers. Print the latter on boot for debug.

---
 xen/arch/arm/setup.c         |   17 +++++++++++++++++
 xen/include/asm-arm/cpregs.h |   18 ++++++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)
xen/arch/arm/setup.c +17 -0
index 51afb31..2433723 100644
@@ -63,6 +63,20 @@ static void __init init_idle_domain(void)
         /* TODO: setup_idle_pagetable(); */
 }
 
+static void processor_id(void)
+{
+    printk("Processor Features: %08x %08x\n",
+           READ_CP32(ID_PFR0), READ_CP32(ID_PFR0));
+    printk("Debug Features: %08x\n", READ_CP32(ID_DFR0));
+    printk("Auxiliary Features: %08x\n", READ_CP32(ID_AFR0));
+    printk("Memory Model Features: %08x %08x %08x %08x\n",
+           READ_CP32(ID_MMFR0), READ_CP32(ID_MMFR1),
+           READ_CP32(ID_MMFR2), READ_CP32(ID_MMFR3));
+    printk("ISA Features: %08x %08x %08x %08x %08x %08x\n",
+           READ_CP32(ID_ISAR0), READ_CP32(ID_ISAR1), READ_CP32(ID_ISAR2),
+           READ_CP32(ID_ISAR3), READ_CP32(ID_ISAR4), READ_CP32(ID_ISAR5));
+}
+
 void __init start_xen(unsigned long boot_phys_offset,
                       unsigned long arm_type,
                       unsigned long atag_paddr)
@@ -127,7 +141,10 @@ void __init start_xen(unsigned long boot_phys_offset,
      */
     WRITE_CP32(0x80002558, VTCR); isb();
 
+    processor_id();
+
     softirq_init();
+
     tasklet_subsys_init();
 
     init_IRQ();
xen/include/asm-arm/cpregs.h +18 -0
index 3a4028d..d61ea88 100644
@@ -93,6 +93,18 @@
 /* CP15 CR0: CPUID and Cache Type Registers */
 #define ID_PFR0         p15,0,c0,c1,0   /* Processor Feature Register 0 */
 #define ID_PFR1         p15,0,c0,c1,1   /* Processor Feature Register 1 */
+#define ID_DFR0         p15,0,c0,c1,2   /* Debug Feature Register 0 */
+#define ID_AFR0         p15,0,c0,c1,3   /* Auxiliary Feature Register 0 */
+#define ID_MMFR0        p15,0,c0,c1,4   /* Memory Model Feature Register 0 */
+#define ID_MMFR1        p15,0,c0,c1,5   /* Memory Model Feature Register 1 */
+#define ID_MMFR2        p15,0,c0,c1,6   /* Memory Model Feature Register 2 */
+#define ID_MMFR3        p15,0,c0,c1,7   /* Memory Model Feature Register 3 */
+#define ID_ISAR0        p15,0,c0,c2,0   /* ISA Feature Register 0 */
+#define ID_ISAR1        p15,0,c0,c2,1   /* ISA Feature Register 1 */
+#define ID_ISAR2        p15,0,c0,c2,2   /* ISA Feature Register 2 */
+#define ID_ISAR3        p15,0,c0,c2,3   /* ISA Feature Register 3 */
+#define ID_ISAR4        p15,0,c0,c2,4   /* ISA Feature Register 4 */
+#define ID_ISAR5        p15,0,c0,c2,5   /* ISA Feature Register 5 */
 #define CCSIDR          p15,1,c0,c0,0   /* Cache Size ID Registers */
 #define CLIDR           p15,1,c0,c0,1   /* Cache Level ID Register */
 #define CSSELR          p15,2,c0,c0,0   /* Cache Size Selection Register */
@@ -134,7 +146,11 @@
 #define ICIALLUIS       p15,0,c7,c1,0   /* Invalidate all instruction caches to PoU inner shareable */
 #define BPIALLIS        p15,0,c7,c1,6   /* Invalidate entire branch predictor array inner shareable */
 #define ICIALLU         p15,0,c7,c5,0   /* Invalidate all instruction caches to PoU */
+#define ICIMVAU         p15,0,c7,c5,1   /* Invalidate instruction caches by MVA to PoU */
 #define BPIALL          p15,0,c7,c5,6   /* Invalidate entire branch predictor array */
+#define BPIMVA          p15,0,c7,c5,7   /* Invalidate MVA from branch predictor array */
+#define DCIMVAC         p15,0,c7,c6,1   /* Invalidate data cache line by MVA to PoC */
+#define DCISW           p15,0,c7,c2,1   /* Invalidate data cache line by set/way */
 #define ATS1CPR         p15,0,c7,c8,0   /* Address Translation Stage 1. Non-Secure Kernel Read */
 #define ATS1CPW         p15,0,c7,c8,1   /* Address Translation Stage 1. Non-Secure Kernel Write */
 #define ATS1CUR         p15,0,c7,c8,2   /* Address Translation Stage 1. Non-Secure User Read */
@@ -144,6 +160,8 @@
 #define ATS12NSOUR      p15,0,c7,c8,6   /* Address Translation Stage 1+2 Non-Secure User Read */
 #define ATS12NSOUW      p15,0,c7,c8,7   /* Address Translation Stage 1+2 Non-Secure User Write */
 #define DCCMVAC         p15,0,c7,c10,1  /* Clean data or unified cache line by MVA to PoC */
+#define DCCSW           p15,0,c7,c10,2  /* Clean data cache line by set/way */
+#define DCCMVAU         p15,0,c7,c11,1  /* Clean data cache line by MVA to PoU */
 #define DCCISW          p15,0,c7,c14,2  /* Clean and invalidate data cache line by set/way */
 #define ATS1HR          p15,4,c7,c8,0   /* Address Translation Stage 1 Hyp. Read */
 #define ATS1HW          p15,4,c7,c8,1   /* Address Translation Stage 1 Hyp. Write */
Signature · 1 line
1.7.2.5
#3 lore raw

PATCH 3/12 arm: align some register bit definitions

In reply to Ian Campbell

Probably got de-hard-tabbed at some point.

---
 xen/include/asm-arm/processor.h |   80 +++++++++++++++++++-------------------
 1 files changed, 40 insertions(+), 40 deletions(-)
xen/include/asm-arm/processor.h +40 -40
index 1f85d31..ec6fb48 100644
@@ -17,12 +17,12 @@
 #define PSR_MODE_UND 0x1b
 #define PSR_MODE_SYS 0x1f
 
-#define PSR_THUMB        (1<<5)        /* Thumb Mode enable */
-#define PSR_FIQ_MASK        (1<<6)        /* Fast Interrupt mask */
-#define PSR_IRQ_MASK        (1<<7)        /* Interrupt mask */
-#define PSR_ABT_MASK         (1<<8)        /* Asynchronous Abort mask */
-#define PSR_BIG_ENDIAN        (1<<9)        /* Big Endian Mode */
-#define PSR_JAZELLE        (1<<24)        /* Jazelle Mode */
+#define PSR_THUMB       (1<<5)        /* Thumb Mode enable */
+#define PSR_FIQ_MASK    (1<<6)        /* Fast Interrupt mask */
+#define PSR_IRQ_MASK    (1<<7)        /* Interrupt mask */
+#define PSR_ABT_MASK    (1<<8)        /* Asynchronous Abort mask */
+#define PSR_BIG_ENDIAN  (1<<9)        /* Big Endian Mode */
+#define PSR_JAZELLE     (1<<24)       /* Jazelle Mode */
 
 /* TTBCR Translation Table Base Control Register */
 #define TTBCR_N_MASK 0x07
@@ -35,56 +35,56 @@
 /* SCTLR System Control Register. */
 /* HSCTLR is a subset of this. */
 #define SCTLR_TE        (1<<30)
-#define SCTLR_AFE        (1<<29)
-#define SCTLR_TRE        (1<<28)
-#define SCTLR_NMFI        (1<<27)
+#define SCTLR_AFE       (1<<29)
+#define SCTLR_TRE       (1<<28)
+#define SCTLR_NMFI      (1<<27)
 #define SCTLR_EE        (1<<25)
 #define SCTLR_VE        (1<<24)
-#define SCTLR_U                (1<<22)
+#define SCTLR_U         (1<<22)
 #define SCTLR_FI        (1<<21)
-#define SCTLR_WXN        (1<<19)
+#define SCTLR_WXN       (1<<19)
 #define SCTLR_HA        (1<<17)
 #define SCTLR_RR        (1<<14)
-#define SCTLR_V                (1<<13)
-#define SCTLR_I                (1<<12)
-#define SCTLR_Z                (1<<11)
+#define SCTLR_V         (1<<13)
+#define SCTLR_I         (1<<12)
+#define SCTLR_Z         (1<<11)
 #define SCTLR_SW        (1<<10)
-#define SCTLR_B                (1<<7)
-#define SCTLR_C                (1<<2)
-#define SCTLR_A                (1<<1)
-#define SCTLR_M                (1<<0)
+#define SCTLR_B         (1<<7)
+#define SCTLR_C         (1<<2)
+#define SCTLR_A         (1<<1)
+#define SCTLR_M         (1<<0)
 
 #define SCTLR_BASE        0x00c50078
-#define HSCTLR_BASE        0x30c51878
+#define HSCTLR_BASE       0x30c51878
 
 /* HCR Hyp Configuration Register */
-#define HCR_TGE                (1<<27)
-#define HCR_TVM                (1<<26)
+#define HCR_TGE         (1<<27)
+#define HCR_TVM         (1<<26)
 #define HCR_TTLB        (1<<25)
-#define HCR_TPU                (1<<24)
-#define HCR_TPC                (1<<23)
-#define HCR_TSW                (1<<22)
-#define HCR_TAC                (1<<21)
-#define HCR_TIDCP        (1<<20)
-#define HCR_TSC                (1<<19)
+#define HCR_TPU         (1<<24)
+#define HCR_TPC         (1<<23)
+#define HCR_TSW         (1<<22)
+#define HCR_TAC         (1<<21)
+#define HCR_TIDCP       (1<<20)
+#define HCR_TSC         (1<<19)
 #define HCR_TID3        (1<<18)
 #define HCR_TID2        (1<<17)
 #define HCR_TID1        (1<<16)
 #define HCR_TID0        (1<<15)
-#define HCR_TWE                (1<<14)
-#define HCR_TWI                (1<<13)
-#define HCR_DC                (1<<12)
-#define HCR_BSU_MASK        (3<<10)
-#define HCR_FB                (1<<9)
-#define HCR_VA                (1<<8)
-#define HCR_VI                (1<<7)
-#define HCR_VF                (1<<6)
-#define HCR_AMO                (1<<5)
-#define HCR_IMO                (1<<4)
-#define HCR_FMO                (1<<3)
-#define HCR_PTW                (1<<2)
+#define HCR_TWE         (1<<14)
+#define HCR_TWI         (1<<13)
+#define HCR_DC          (1<<12)
+#define HCR_BSU_MASK    (3<<10)
+#define HCR_FB          (1<<9)
+#define HCR_VA          (1<<8)
+#define HCR_VI          (1<<7)
+#define HCR_VF          (1<<6)
+#define HCR_AMO         (1<<5)
+#define HCR_IMO         (1<<4)
+#define HCR_FMO         (1<<3)
+#define HCR_PTW         (1<<2)
 #define HCR_SWIO        (1<<1)
-#define HCR_VM                (1<<0)
+#define HCR_VM          (1<<0)
 
 #define HSR_EC_WFI_WFE              0x01
 #define HSR_EC_CP15_32              0x03
Signature · 1 line
1.7.2.5
#4 lore raw

PATCH 4/12 arm: remove some unnecessary symbols from dummy.S

In reply to Ian Campbell

Correct the comment on the DUMMY macro.

---
 xen/arch/arm/dummy.S |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
xen/arch/arm/dummy.S +1 -7
index 5bc4f21..fff7d7e 100644
@@ -1,8 +1,6 @@
-/* Nothing is mapped at 1G, for the moment */
 #define DUMMY(x) \
 	.globl x; \
-x:	.word 0xe7f000f0
-/* x:	mov r0, #0x40000000 ; str r0, [r0]; b x */
+x:	.word 0xe7f000f0 /* Undefined instruction */
 
 #define  NOP(x) \
 	.globl x; \
@@ -35,15 +33,11 @@ DUMMY(get_page);
 DUMMY(get_page_type);
 DUMMY(gmfn_to_mfn);
 DUMMY(gnttab_clear_flag);
-DUMMY(gnttab_host_mapping_get_page_type);
 DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
 DUMMY(iommu_map_page);
 DUMMY(iommu_unmap_page);
 DUMMY(is_iomem_page);
-DUMMY(local_event_delivery_enable);
-DUMMY(local_events_need_delivery);
-DUMMY(machine_to_phys_mapping_valid);
 DUMMY(max_page);
 DUMMY(node_online_map);
 DUMMY(nr_irqs_gsi);
Signature · 1 line
1.7.2.5
#5 lore raw

PATCH 5/12 arm: Add stub functions instead of using DUMMY

In reply to Ian Campbell

Adds stubs for arch domctl and sysctl plus vcpu_op and memory_op.

---
 xen/arch/arm/Makefile |    3 +++
 xen/arch/arm/domain.c |    5 +++++
 xen/arch/arm/domctl.c |   27 +++++++++++++++++++++++++++
 xen/arch/arm/dummy.S  |    4 ----
 xen/arch/arm/mm.c     |    5 +++++
 xen/arch/arm/sysctl.c |   29 +++++++++++++++++++++++++++++
 6 files changed, 69 insertions(+), 4 deletions(-)
 create mode 100644 xen/arch/arm/domctl.c
 create mode 100644 xen/arch/arm/sysctl.c
xen/arch/arm/Makefile +3 -0
index 9bc2fc8..e6745f4 100644
@@ -2,7 +2,10 @@ subdir-y += lib
 
 obj-y += dummy.o
 obj-y += entry.o
+obj-y += cache.o
 obj-y += domain.o
+obj-y += domctl.o
+obj-y += sysctl.o
 obj-y += domain_build.o
 obj-y += gic.o
 obj-y += io.o
xen/arch/arm/domain.c +5 -0
index ada89af..5fe370b 100644
@@ -255,6 +255,11 @@ void arch_dump_domain_info(struct domain *d)
 {
 }
 
+long arch_do_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg)
+{
+    return -ENOSYS;
+}
+
 void arch_dump_vcpu_info(struct vcpu *v)
 {
 }
xen/arch/arm/domctl.c new file +27 -0
new file mode 100644
index 0000000..d957f21
@@ -0,0 +1,27 @@
+/******************************************************************************
+ * Arch-specific domctl.c
+ *
+ * Copyright (c) 2012, Citrix Systems
+ */
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include <public/domctl.h>
+
+long arch_do_domctl(struct xen_domctl *domctl,
+                    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
+{
+	return -ENOSYS;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
xen/arch/arm/dummy.S +0 -4
index fff7d7e..1287e0b 100644
@@ -8,12 +8,8 @@ x:	mov pc, lr
 	
 DUMMY(alloc_pirq_struct);
 DUMMY(alloc_vcpu_guest_context);
-DUMMY(arch_do_domctl);
-DUMMY(arch_do_sysctl);
-DUMMY(arch_do_vcpu_op);
 DUMMY(arch_get_info_guest);
 DUMMY(arch_get_xen_caps);
-DUMMY(arch_memory_op);
 DUMMY(arch_set_info_guest);
 DUMMY(arch_vcpu_reset);
 DUMMY(create_grant_host_mapping);
xen/arch/arm/mm.c +5 -0
index 613d084..45971cb 100644
@@ -311,6 +311,11 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
     frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pages * sizeof(struct page_info));
 }
 
+long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)
+{
+    return -ENOSYS;
+}
+
 /*
  * Local variables:
  * mode: C
xen/arch/arm/sysctl.c new file +29 -0
new file mode 100644
index 0000000..20a16f9
@@ -0,0 +1,29 @@
+/******************************************************************************
+ * Arch-specific domctl.c
+ *
+ * System management operations. For use by node control stack.
+ *
+ * Copyright (c) 2012, Citrix Systems
+ */
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include <public/sysctl.h>
+
+long arch_do_sysctl(struct xen_sysctl *sysctl,
+		    XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
+{
+	return -ENOSYS;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
Signature · 1 line
1.7.2.5
#6 lore raw

PATCH 6/12 PM: only include XEN_SYSCTL_{get_pmstat, pm_op} if HAVE_ACPI

In reply to Ian Campbell

These hypercalls are currently ACPI specific and implemented in xen/drivers/acpi which is not implemented on ARM.

---
 xen/Rules.mk         |    1 +
 xen/arch/arm/dummy.S |    2 --
 xen/common/sysctl.c  |    2 ++
 3 files changed, 3 insertions(+), 2 deletions(-)
xen/Rules.mk +1 -0
index 59c7dd7..b7b54f6 100644
@@ -50,6 +50,7 @@ CFLAGS-$(crash_debug)   += -DCRASH_DEBUG
 CFLAGS-$(perfc)         += -DPERF_COUNTERS
 CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
+CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
xen/arch/arm/dummy.S +0 -2
index 1287e0b..3bf5226 100644
@@ -16,13 +16,11 @@ DUMMY(create_grant_host_mapping);
 DUMMY(__cpu_die);
 DUMMY(__cpu_disable);
 DUMMY(__cpu_up);
-DUMMY(do_get_pm_info);
 DUMMY(domain_get_maximum_gpfn);
 DUMMY(domain_relinquish_resources);
 DUMMY(domain_set_time_offset);
 DUMMY(dom_cow);
 DUMMY(donate_page);
-DUMMY(do_pm_op);
 DUMMY(flush_tlb_mask);
 DUMMY(free_vcpu_guest_context);
 DUMMY(get_page);
xen/common/sysctl.c +2 -0
index f8f7cf8..fef0589 100644
@@ -224,6 +224,7 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
     }
     break;
 
+#ifdef HAS_ACPI
     case XEN_SYSCTL_get_pmstat:
     {
         ret = xsm_get_pmstat();
@@ -259,6 +260,7 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
         }
     }
     break;
+#endif
 
     case XEN_SYSCTL_page_offline_op:
     {
Signature · 1 line
1.7.2.5
#7 lore raw

PATCH 7/12 xen: allow tmem to be disabled on platforms which do not support it (ARM)

In reply to Ian Campbell
---
 xen/Rules.mk               |    1 +
 xen/arch/arm/dummy.S       |    1 -
 xen/arch/ia64/Rules.mk     |    1 +
 xen/arch/x86/Rules.mk      |    1 +
 xen/common/Makefile        |    4 ++--
 xen/common/page_alloc.c    |    1 +
 xen/include/xen/tmem.h     |    9 +++++++++
 xen/include/xen/tmem_xen.h |    5 +++++
 8 files changed, 20 insertions(+), 3 deletions(-)
xen/Rules.mk +1 -0
index b7b54f6..e25e8d4 100644
@@ -51,6 +51,7 @@ CFLAGS-$(perfc)         += -DPERF_COUNTERS
 CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
 CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
+CFLAGS-$(HAS_TMEM)      += -DHAS_TMEM
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
xen/arch/arm/dummy.S +0 -1
index 3bf5226..da0b906 100644
@@ -20,7 +20,6 @@ DUMMY(domain_get_maximum_gpfn);
 DUMMY(domain_relinquish_resources);
 DUMMY(domain_set_time_offset);
 DUMMY(dom_cow);
-DUMMY(donate_page);
 DUMMY(flush_tlb_mask);
 DUMMY(free_vcpu_guest_context);
 DUMMY(get_page);
xen/arch/ia64/Rules.mk +1 -0
index 054b4de..6c8cf69 100644
@@ -9,6 +9,7 @@ HAS_PCI := y
 HAS_PASSTHROUGH := y
 HAS_NS16550 := y
 HAS_KEXEC := y
+HAS_TMEM := y
 xenoprof := y
 no_warns ?= n
 vti_debug ?= n
xen/arch/x86/Rules.mk +1 -0
index 1e48877..8802a69 100644
@@ -8,6 +8,7 @@ HAS_PCI := y
 HAS_PASSTHROUGH := y
 HAS_NS16550 := y
 HAS_KEXEC := y
+HAS_TMEM := y
 xenoprof := y
 
 #
xen/common/Makefile +2 -2
index 9249845..68a2df1 100644
@@ -38,8 +38,8 @@ obj-y += vsprintf.o
 obj-y += wait.o
 obj-y += xmalloc_tlsf.o
 obj-y += rcupdate.o
-obj-y += tmem.o
-obj-y += tmem_xen.o
+obj-$(HAS_TMEM) += tmem.o
+obj-$(HAS_TMEM) += tmem_xen.o
 obj-y += radix-tree.o
 obj-y += rbtree.o
 obj-y += lzo.o
xen/common/page_alloc.c +1 -0
index 249bb35..3aac830 100644
@@ -35,6 +35,7 @@
 #include <xen/perfc.h>
 #include <xen/numa.h>
 #include <xen/nodemask.h>
+#include <xen/errno.h>
 #include <xen/tmem.h>
 #include <xen/tmem_xen.h>
 #include <public/sysctl.h>
xen/include/xen/tmem.h +9 -0
index 5dbf9d5..2ebffb4 100644
@@ -9,8 +9,17 @@
 #ifndef __XEN_TMEM_H__
 #define __XEN_TMEM_H__
 
+#ifdef HAS_TMEM
 extern void tmem_destroy(void *);
 extern void *tmem_relinquish_pages(unsigned int, unsigned int);
 extern unsigned long tmem_freeable_pages(void);
+#else
+static inline void tmem_destroy(void *v) {}
+static inline void *tmem_relinquish_pages(unsigned int order, unsigned int flags)
+{
+	return NULL;
+}
+static inline unsigned long tmem_freeable_pages(void) { return 0; }
+#endif
 
 #endif /* __XEN_TMEM_H__ */
xen/include/xen/tmem_xen.h +5 -0
index fdbeed1..a6c0672 100644
@@ -9,6 +9,7 @@
 #ifndef __XEN_TMEM_XEN_H__
 #define __XEN_TMEM_XEN_H__
 
+#ifdef HAS_TMEM
 #include <xen/config.h>
 #include <xen/mm.h> /* heap alloc/free */
 #include <xen/pfn.h>
@@ -559,4 +560,8 @@ extern int tmh_copy_tze_to_client(tmem_cli_mfn_t cmfn, void *tmem_va, pagesize_t
 #define RESET_CYC_COUNTER(x) do { } while (0)
 #endif
 
+#else /* HAS_TMEM */
+#define opt_tmem 0
+#endif
+
 #endif /* __XEN_TMEM_XEN_H__ */
Signature · 1 line
1.7.2.5
#8 lore raw

Re: [PATCH 07/12] xen: allow tmem to be disabled on platforms which do not support it (ARM)

Why do we need this?
I though that tmem compiled OK on ARM. Also I don't think there is any architectural limitation that would prevent tmem from working on ARM, right?
If the goal is to remove DUMMY(donate_page) maybe it is better to introduce a stub function instead?

Quoted 139 lines · Ian Campbell
---
 xen/Rules.mk               |    1 +
 xen/arch/arm/dummy.S       |    1 -
 xen/arch/ia64/Rules.mk     |    1 +
 xen/arch/x86/Rules.mk      |    1 +
 xen/common/Makefile        |    4 ++--
 xen/common/page_alloc.c    |    1 +
 xen/include/xen/tmem.h     |    9 +++++++++
 xen/include/xen/tmem_xen.h |    5 +++++
 8 files changed, 20 insertions(+), 3 deletions(-)
xen/Rules.mk +1 -0
index b7b54f6..e25e8d4 100644
@@ -51,6 +51,7 @@ CFLAGS-$(perfc)         += -DPERF_COUNTERS
 CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
 CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
+CFLAGS-$(HAS_TMEM)      += -DHAS_TMEM
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
xen/arch/arm/dummy.S +0 -1
index 3bf5226..da0b906 100644
@@ -20,7 +20,6 @@ DUMMY(domain_get_maximum_gpfn);
 DUMMY(domain_relinquish_resources);
 DUMMY(domain_set_time_offset);
 DUMMY(dom_cow);
-DUMMY(donate_page);
 DUMMY(flush_tlb_mask);
 DUMMY(free_vcpu_guest_context);
 DUMMY(get_page);
xen/arch/ia64/Rules.mk +1 -0
index 054b4de..6c8cf69 100644
@@ -9,6 +9,7 @@ HAS_PCI := y
 HAS_PASSTHROUGH := y
 HAS_NS16550 := y
 HAS_KEXEC := y
+HAS_TMEM := y
 xenoprof := y
 no_warns ?= n
 vti_debug ?= n
xen/arch/x86/Rules.mk +1 -0
index 1e48877..8802a69 100644
@@ -8,6 +8,7 @@ HAS_PCI := y
 HAS_PASSTHROUGH := y
 HAS_NS16550 := y
 HAS_KEXEC := y
+HAS_TMEM := y
 xenoprof := y
 
 #
xen/common/Makefile +2 -2
index 9249845..68a2df1 100644
@@ -38,8 +38,8 @@ obj-y += vsprintf.o
 obj-y += wait.o
 obj-y += xmalloc_tlsf.o
 obj-y += rcupdate.o
-obj-y += tmem.o
-obj-y += tmem_xen.o
+obj-$(HAS_TMEM) += tmem.o
+obj-$(HAS_TMEM) += tmem_xen.o
 obj-y += radix-tree.o
 obj-y += rbtree.o
 obj-y += lzo.o
xen/common/page_alloc.c +1 -0
index 249bb35..3aac830 100644
@@ -35,6 +35,7 @@
 #include <xen/perfc.h>
 #include <xen/numa.h>
 #include <xen/nodemask.h>
+#include <xen/errno.h>
 #include <xen/tmem.h>
 #include <xen/tmem_xen.h>
 #include <public/sysctl.h>
xen/include/xen/tmem.h +9 -0
index 5dbf9d5..2ebffb4 100644
@@ -9,8 +9,17 @@
 #ifndef __XEN_TMEM_H__
 #define __XEN_TMEM_H__
 
+#ifdef HAS_TMEM
 extern void tmem_destroy(void *);
 extern void *tmem_relinquish_pages(unsigned int, unsigned int);
 extern unsigned long tmem_freeable_pages(void);
+#else
+static inline void tmem_destroy(void *v) {}
+static inline void *tmem_relinquish_pages(unsigned int order, unsigned int flags)
+{
+	return NULL;
+}
+static inline unsigned long tmem_freeable_pages(void) { return 0; }
+#endif
 
 #endif /* __XEN_TMEM_H__ */
xen/include/xen/tmem_xen.h +5 -0
index fdbeed1..a6c0672 100644
@@ -9,6 +9,7 @@
 #ifndef __XEN_TMEM_XEN_H__
 #define __XEN_TMEM_XEN_H__
 
+#ifdef HAS_TMEM
 #include <xen/config.h>
 #include <xen/mm.h> /* heap alloc/free */
 #include <xen/pfn.h>
@@ -559,4 +560,8 @@ extern int tmh_copy_tze_to_client(tmem_cli_mfn_t cmfn, void *tmem_va, pagesize_t
 #define RESET_CYC_COUNTER(x) do { } while (0)
 #endif
 
+#else /* HAS_TMEM */
+#define opt_tmem 0
+#endif
+
 #endif /* __XEN_TMEM_XEN_H__ */
Signature · 7 lines
1.7.2.5


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
#9 lore raw

Re: [PATCH 07/12] xen: allow tmem to be disabled on platforms which do not support it (ARM)

Quoted 4 lines · Stefano Stabellini

Why do we need this?
I though that tmem compiled OK on ARM. Also I don't think there is any architectural limitation that would prevent tmem from working on ARM, right?

It may compile but it surely won't work. :) Does tmem work at all for non-PV guests?

Tim.

#10 lore raw

Re: [PATCH 07/12] xen: allow tmem to be disabled on platforms which do not support it (ARM)

Quoted 9 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
Quoted 4 lines · Stefano Stabellini

Why do we need this?
I though that tmem compiled OK on ARM. Also I don't think there is any architectural limitation that would prevent tmem from working on ARM, right?

It may compile but it surely won't work. :) Does tmem work at all for non-PV guests?

Supposedly yes, otherwise it wouldn't be wired up in the HVM hypercall tables. Dan?

Jan

#11 lore raw

Re: [PATCH 07/12] xen: allow tmem to be disabled on platforms which do not support it (ARM)

I'm away for a few days. HVM works fine. Everything should be portable to ARM though it's never been tested afaik so may need a tweak or two. If someone wants to try it I'd be happy to help after I return

Sent from my iPhone

Quoted 15 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
Quoted 4 lines · Stefano Stabellini

Why do we need this?
I though that tmem compiled OK on ARM. Also I don't think there is any architectural limitation that would prevent tmem from working on ARM, right?

It may compile but it surely won't work. :) Does tmem work at all for non-PV guests?

Supposedly yes, otherwise it wouldn't be wired up in the HVM hypercall tables. Dan?

Jan

#12 lore raw

Re: [PATCH 07/12] xen: allow tmem to be disabled on platforms which do not support it (ARM)

In reply to Stefano Stabellini
Quoted 2 lines · Stefano Stabellini

Why do we need this?
I though that tmem compiled OK on ARM.

But it can't possibly work, as evidenced by the missing symbol in dummy.S! There is no point in compiling something which cannot work.

Quoted 3 lines

Also I don't think there is any
architectural limitation that would prevent tmem from working on ARM, right?

Not really an architectural thing but a "not yet implemented thing". tmem is quite a long way down the list of things we need to do for ARM right now. I'd be quite happy to have this patch reverted at some point in the future but for now there is no point in pretending that tmem works.

Quoted 2 lines

If the goal is to remove DUMMY(donate_page) maybe it is better to introduce a stub function instead?

A stub would be no better than the dummy function in this case. It needs to actually do things which we cannot do yet on ARM.

dummy.S is a total hack and we should be aiming to remove it ASAP.

Ian.

Quoted 141 lines · Ian Campbell
Quoted 139 lines
---
 xen/Rules.mk               |    1 +
 xen/arch/arm/dummy.S       |    1 -
 xen/arch/ia64/Rules.mk     |    1 +
 xen/arch/x86/Rules.mk      |    1 +
 xen/common/Makefile        |    4 ++--
 xen/common/page_alloc.c    |    1 +
 xen/include/xen/tmem.h     |    9 +++++++++
 xen/include/xen/tmem_xen.h |    5 +++++
 8 files changed, 20 insertions(+), 3 deletions(-)
xen/Rules.mk +1 -0
index b7b54f6..e25e8d4 100644
@@ -51,6 +51,7 @@ CFLAGS-$(perfc)         += -DPERF_COUNTERS
 CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
 CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
+CFLAGS-$(HAS_TMEM)      += -DHAS_TMEM
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
xen/arch/arm/dummy.S +0 -1
index 3bf5226..da0b906 100644
@@ -20,7 +20,6 @@ DUMMY(domain_get_maximum_gpfn);
 DUMMY(domain_relinquish_resources);
 DUMMY(domain_set_time_offset);
 DUMMY(dom_cow);
-DUMMY(donate_page);
 DUMMY(flush_tlb_mask);
 DUMMY(free_vcpu_guest_context);
 DUMMY(get_page);
xen/arch/ia64/Rules.mk +1 -0
index 054b4de..6c8cf69 100644
@@ -9,6 +9,7 @@ HAS_PCI := y
 HAS_PASSTHROUGH := y
 HAS_NS16550 := y
 HAS_KEXEC := y
+HAS_TMEM := y
 xenoprof := y
 no_warns ?= n
 vti_debug ?= n
xen/arch/x86/Rules.mk +1 -0
index 1e48877..8802a69 100644
@@ -8,6 +8,7 @@ HAS_PCI := y
 HAS_PASSTHROUGH := y
 HAS_NS16550 := y
 HAS_KEXEC := y
+HAS_TMEM := y
 xenoprof := y
 
 #
xen/common/Makefile +2 -2
index 9249845..68a2df1 100644
@@ -38,8 +38,8 @@ obj-y += vsprintf.o
 obj-y += wait.o
 obj-y += xmalloc_tlsf.o
 obj-y += rcupdate.o
-obj-y += tmem.o
-obj-y += tmem_xen.o
+obj-$(HAS_TMEM) += tmem.o
+obj-$(HAS_TMEM) += tmem_xen.o
 obj-y += radix-tree.o
 obj-y += rbtree.o
 obj-y += lzo.o
xen/common/page_alloc.c +1 -0
index 249bb35..3aac830 100644
@@ -35,6 +35,7 @@
 #include <xen/perfc.h>
 #include <xen/numa.h>
 #include <xen/nodemask.h>
+#include <xen/errno.h>
 #include <xen/tmem.h>
 #include <xen/tmem_xen.h>
 #include <public/sysctl.h>
xen/include/xen/tmem.h +9 -0
index 5dbf9d5..2ebffb4 100644
@@ -9,8 +9,17 @@
 #ifndef __XEN_TMEM_H__
 #define __XEN_TMEM_H__
 
+#ifdef HAS_TMEM
 extern void tmem_destroy(void *);
 extern void *tmem_relinquish_pages(unsigned int, unsigned int);
 extern unsigned long tmem_freeable_pages(void);
+#else
+static inline void tmem_destroy(void *v) {}
+static inline void *tmem_relinquish_pages(unsigned int order, unsigned int flags)
+{
+	return NULL;
+}
+static inline unsigned long tmem_freeable_pages(void) { return 0; }
+#endif
 
 #endif /* __XEN_TMEM_H__ */
xen/include/xen/tmem_xen.h +5 -0
index fdbeed1..a6c0672 100644
@@ -9,6 +9,7 @@
 #ifndef __XEN_TMEM_XEN_H__
 #define __XEN_TMEM_XEN_H__
 
+#ifdef HAS_TMEM
 #include <xen/config.h>
 #include <xen/mm.h> /* heap alloc/free */
 #include <xen/pfn.h>
@@ -559,4 +560,8 @@ extern int tmh_copy_tze_to_client(tmem_cli_mfn_t cmfn, void *tmem_va, pagesize_t
 #define RESET_CYC_COUNTER(x) do { } while (0)
 #endif
 
+#else /* HAS_TMEM */
+#define opt_tmem 0
+#endif
+
 #endif /* __XEN_TMEM_XEN_H__ */
Signature · 7 lines
1.7.2.5


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
#13 lore raw

Re: [PATCH 07/12] xen: allow tmem to be disabled on platforms which do not support it (ARM)

Quoted 7 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 2 lines · Stefano Stabellini

Why do we need this?
I though that tmem compiled OK on ARM.

But it can't possibly work, as evidenced by the missing symbol in dummy.S! There is no point in compiling something which cannot work.

But introducing random HAS_xyz variables isn't that pretty either. The more that the term 'has' seems wrong to me in this case.

By just not wiring up the hypercall you could achieve the same effect.

Jan

#14 lore raw

Re: [PATCH 07/12] xen: allow tmem to be disabled on platforms which do not support it (ARM)

Quoted 10 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 2 lines · Stefano Stabellini

Why do we need this?
I though that tmem compiled OK on ARM.

But it can't possibly work, as evidenced by the missing symbol in dummy.S! There is no point in compiling something which cannot work.

But introducing random HAS_xyz variables isn't that pretty either. The more that the term 'has' seems wrong to me in this case.

yeah, I was copy the other similar variables. Probably ENABLE would be better in this case.

Quoted 1 line

By just not wiring up the hypercall you could achieve the same effect.

Really? I'd still need to ifdef out the hypercall body or I'd get unresolved symbols, wouldn't I?

Ian.

#15 lore raw

Re: [PATCH 07/12] xen: allow tmem to be disabled on platforms which do not support it (ARM)

Quoted 13 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 10 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 2 lines · Stefano Stabellini

Why do we need this?
I though that tmem compiled OK on ARM.

But it can't possibly work, as evidenced by the missing symbol in dummy.S! There is no point in compiling something which cannot work.

But introducing random HAS_xyz variables isn't that pretty either. The more that the term 'has' seems wrong to me in this case.

Quoted 7 lines

yeah, I was copy the other similar variables. Probably ENABLE would be better in this case.

Quoted 1 line

By just not wiring up the hypercall you could achieve the same effect.

Really? I'd still need to ifdef out the hypercall body or I'd get unresolved symbols, wouldn't I?

Perhaps, but stubbing out dead symbols in a new port seems prettier to me than cluttering common code.

Jan

#16 lore raw

PATCH 8/12 arm: Implement arch_get_xen_caps

In reply to Ian Campbell

TBD: correct arch name for this string. Should be "xen-" / "hvm-" or something else given the hybrid model we are using on ARM?

---
 xen/arch/arm/dummy.S |    1 -
 xen/arch/arm/mm.c    |    1 +
 xen/arch/arm/setup.c |   12 ++++++++++++
 3 files changed, 13 insertions(+), 1 deletions(-)
xen/arch/arm/dummy.S +0 -1
index da0b906..5010619 100644
@@ -9,7 +9,6 @@ x:	mov pc, lr
 DUMMY(alloc_pirq_struct);
 DUMMY(alloc_vcpu_guest_context);
 DUMMY(arch_get_info_guest);
-DUMMY(arch_get_xen_caps);
 DUMMY(arch_set_info_guest);
 DUMMY(arch_vcpu_reset);
 DUMMY(create_grant_host_mapping);
xen/arch/arm/mm.c +1 -0
index 45971cb..50c3634 100644
@@ -23,6 +23,7 @@
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/preempt.h>
+#include <xen/errno.h>
 #include <asm/page.h>
 #include <asm/current.h>
 
xen/arch/arm/setup.c +12 -0
index 2433723..2fcde24 100644
@@ -213,6 +213,18 @@ void __init start_xen(unsigned long boot_phys_offset,
     reset_stack_and_jump(init_done);
 }
 
+void arch_get_xen_caps(xen_capabilities_info_t *info)
+{
+    /* Interface name is always xen-3.0-* for Xen-3.x. */
+    int major = 3, minor = 0;
+    char s[32];
+
+    (*info)[0] = '\0';
+
+    snprintf(s, sizeof(s), "xen-%d.%d-armv7l ", major, minor);
+    safe_strcat(*info, s);
+}
+
 /*
  * Local variables:
  * mode: C
Signature · 1 line
1.7.2.5
#17 lore raw

PATCH 9/12 xen: only map PV guest grants via iommu if HAS_PASSTHROUGH

In reply to Ian Campbell
---
 xen/Rules.mk             |    1 +
 xen/arch/arm/dummy.S     |    2 --
 xen/common/grant_table.c |    6 ++++++
 3 files changed, 7 insertions(+), 2 deletions(-)
xen/Rules.mk +1 -0
index e25e8d4..ce88316 100644
@@ -52,6 +52,7 @@ CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
 CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
 CFLAGS-$(HAS_TMEM)      += -DHAS_TMEM
+CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
xen/arch/arm/dummy.S +0 -2
index 5010619..e858613 100644
@@ -27,8 +27,6 @@ DUMMY(gmfn_to_mfn);
 DUMMY(gnttab_clear_flag);
 DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
-DUMMY(iommu_map_page);
-DUMMY(iommu_unmap_page);
 DUMMY(is_iomem_page);
 DUMMY(max_page);
 DUMMY(node_online_map);
xen/common/grant_table.c +6 -0
index b024016..1798fcd 100644
@@ -434,6 +434,7 @@ static int _set_status(unsigned gt_version,
         return _set_status_v2(domid, readonly, mapflag, shah, act, status);
 }
 
+#ifdef HAS_PASSTHROUGH
 static void mapcount(
     struct domain *ld, unsigned long mfn,
     unsigned int *wrc, unsigned int *rdc)
@@ -456,6 +457,7 @@ static void mapcount(
         rcu_unlock_domain(rd);
     }
 }
+#endif
 
 /*
  * Returns 0 if TLB flush / invalidate required by caller.
@@ -662,6 +664,7 @@ __gnttab_map_grant_ref(
         goto undo_out;
     }
 
+#ifdef HAS_PASSTHROUGH
     if ( !is_hvm_domain(ld) && need_iommu(ld) )
     {
         unsigned int wrc, rdc;
@@ -689,6 +692,7 @@ __gnttab_map_grant_ref(
             goto undo_out;
         }
     }
+#endif
 
     TRACE_1D(TRC_MEM_PAGE_GRANT_MAP, op->dom);
 
@@ -858,6 +862,7 @@ __gnttab_unmap_common(
             act->pin -= GNTPIN_hstw_inc;
     }
 
+#ifdef HAS_PASSTHROUGH
     if ( !is_hvm_domain(ld) && need_iommu(ld) )
     {
         unsigned int wrc, rdc;
@@ -874,6 +879,7 @@ __gnttab_unmap_common(
             goto unmap_out;
         }
     }
+#endif
 
     /* If just unmapped a writable mapping, mark as dirtied */
     if ( !(op->flags & GNTMAP_readonly) )
Signature · 1 line
1.7.2.5
#18 lore raw

Re: [PATCH 09/12] xen: only map PV guest grants via iommu if HAS_PASSTHROUGH

Quoted 54 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
---
 xen/Rules.mk             |    1 +
 xen/arch/arm/dummy.S     |    2 --
 xen/common/grant_table.c |    6 ++++++
 3 files changed, 7 insertions(+), 2 deletions(-)
xen/Rules.mk +1 -0
index e25e8d4..ce88316 100644
@@ -52,6 +52,7 @@ CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
 CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
 CFLAGS-$(HAS_TMEM)      += -DHAS_TMEM
+CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
xen/arch/arm/dummy.S +0 -2
index 5010619..e858613 100644
@@ -27,8 +27,6 @@ DUMMY(gmfn_to_mfn);
 DUMMY(gnttab_clear_flag);
 DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
-DUMMY(iommu_map_page);
-DUMMY(iommu_unmap_page);
 DUMMY(is_iomem_page);
 DUMMY(max_page);
 DUMMY(node_online_map);
xen/common/grant_table.c +2 -0
index b024016..1798fcd 100644
@@ -434,6 +434,7 @@ static int _set_status(unsigned gt_version,
         return _set_status_v2(domid, readonly, mapflag, shah, act, status);
 }
 
+#ifdef HAS_PASSTHROUGH
 static void mapcount(
     struct domain *ld, unsigned long mfn,
     unsigned int *wrc, unsigned int *rdc)
@@ -456,6 +457,7 @@ static void mapcount(
         rcu_unlock_domain(rd);
     }
 }
+#endif
 
 /*
  * Returns 0 if TLB flush / invalidate required by caller.

xen/common/grant_table.c __gnttab_map_grant_ref( · line 668

Quoted 5 lines
xen/common/grant_table.c +1 -0
@@ -662,6 +664,7 @@ __gnttab_map_grant_ref(
         goto undo_out;
     }
 
+#ifdef HAS_PASSTHROUGH
     if ( !is_hvm_domain(ld) && need_iommu(ld) )

Wouldn't #define-ing need_iommu() to 0 in the ARM headers achieve the same effect, without cluttering common code?

Jan

Quoted 34 lines
xen/common/grant_table.c +3 -0
     {
         unsigned int wrc, rdc;
@@ -689,6 +692,7 @@ __gnttab_map_grant_ref(
             goto undo_out;
         }
     }
+#endif
 
     TRACE_1D(TRC_MEM_PAGE_GRANT_MAP, op->dom);
 
@@ -858,6 +862,7 @@ __gnttab_unmap_common(
             act->pin -= GNTPIN_hstw_inc;
     }
 
+#ifdef HAS_PASSTHROUGH
     if ( !is_hvm_domain(ld) && need_iommu(ld) )
     {
         unsigned int wrc, rdc;
@@ -874,6 +879,7 @@ __gnttab_unmap_common(
             goto unmap_out;
         }
     }
+#endif
 
     /* If just unmapped a writable mapping, mark as dirtied */
     if ( !(op->flags & GNTMAP_readonly) )
Signature · 7 lines
1.7.2.5


_______________________________________________
Xen-devel mailing list
[email protected] 
http://lists.xensource.com/xen-devel 
#19 lore raw

Re: [PATCH 09/12] xen: only map PV guest grants via iommu if HAS_PASSTHROUGH

Quoted 57 lines · Jan Beulich
Quoted 57 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
---
 xen/Rules.mk             |    1 +
 xen/arch/arm/dummy.S     |    2 --
 xen/common/grant_table.c |    6 ++++++
 3 files changed, 7 insertions(+), 2 deletions(-)
xen/Rules.mk +1 -0
index e25e8d4..ce88316 100644
@@ -52,6 +52,7 @@ CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
 CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
 CFLAGS-$(HAS_TMEM)      += -DHAS_TMEM
+CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
xen/arch/arm/dummy.S +0 -2
index 5010619..e858613 100644
@@ -27,8 +27,6 @@ DUMMY(gmfn_to_mfn);
 DUMMY(gnttab_clear_flag);
 DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
-DUMMY(iommu_map_page);
-DUMMY(iommu_unmap_page);
 DUMMY(is_iomem_page);
 DUMMY(max_page);
 DUMMY(node_online_map);
xen/common/grant_table.c +2 -0
index b024016..1798fcd 100644
@@ -434,6 +434,7 @@ static int _set_status(unsigned gt_version,
         return _set_status_v2(domid, readonly, mapflag, shah, act, status);
 }
 
+#ifdef HAS_PASSTHROUGH
 static void mapcount(
     struct domain *ld, unsigned long mfn,
     unsigned int *wrc, unsigned int *rdc)
@@ -456,6 +457,7 @@ static void mapcount(
         rcu_unlock_domain(rd);
     }
 }
+#endif
 
 /*
  * Returns 0 if TLB flush / invalidate required by caller.
@@ -662,6 +664,7 @@ __gnttab_map_grant_ref(
         goto undo_out;
     }
 
Quoted 5 lines

xen/common/grant_table.c __gnttab_map_grant_ref( · line 668

Quoted 2 lines
xen/common/grant_table.c +1 -0
+#ifdef HAS_PASSTHROUGH
     if ( !is_hvm_domain(ld) && need_iommu(ld) )

Wouldn't #define-ing need_iommu() to 0 in the ARM headers achieve the same effect, without cluttering common code?

Yes. I'd thought there were other uses of need_iommu but in fact they are all in x86.

Ian.

#20 lore raw

Re: [PATCH 09/12] xen: only map PV guest grants via iommu if HAS_PASSTHROUGH

Quoted 60 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 31 lines · Jan Beulich
Quoted 31 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
---
 xen/Rules.mk             |    1 +
 xen/arch/arm/dummy.S     |    2 --
 xen/common/grant_table.c |    6 ++++++
 3 files changed, 7 insertions(+), 2 deletions(-)
xen/Rules.mk +1 -0
index e25e8d4..ce88316 100644
@@ -52,6 +52,7 @@ CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
 CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
 CFLAGS-$(HAS_TMEM)      += -DHAS_TMEM
+CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
xen/arch/arm/dummy.S +0 -2
index 5010619..e858613 100644
@@ -27,8 +27,6 @@ DUMMY(gmfn_to_mfn);
 DUMMY(gnttab_clear_flag);
 DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
-DUMMY(iommu_map_page);
-DUMMY(iommu_unmap_page);
 DUMMY(is_iomem_page);
Quoted 8 lines

xen/common/grant_table.c static int _set_status(unsigned gt_version, · line 434

Quoted 8 lines
xen/arch/arm/dummy.S +0 -0
 DUMMY(max_page);
 DUMMY(node_online_map);
xen/common/grant_table.c +0 -0
index b024016..1798fcd 100644
@@ -434,6 +434,7 @@ static int _set_status(unsigned gt_version,
         return _set_status_v2(domid, readonly, mapflag, shah, act, 

status);

Quoted 18 lines
Quoted 18 lines
xen/common/grant_table.c +2 -0
 }
 
+#ifdef HAS_PASSTHROUGH
 static void mapcount(
     struct domain *ld, unsigned long mfn,
     unsigned int *wrc, unsigned int *rdc)
@@ -456,6 +457,7 @@ static void mapcount(
         rcu_unlock_domain(rd);
     }
 }
+#endif
 
 /*
  * Returns 0 if TLB flush / invalidate required by caller.
@@ -662,6 +664,7 @@ __gnttab_map_grant_ref(
         goto undo_out;
     }
 
Quoted 8 lines
Quoted 5 lines

xen/common/grant_table.c __gnttab_map_grant_ref( · line 668

Quoted 2 lines
xen/common/grant_table.c +1 -0
+#ifdef HAS_PASSTHROUGH
     if ( !is_hvm_domain(ld) && need_iommu(ld) )

Wouldn't #define-ing need_iommu() to 0 in the ARM headers achieve the same effect, without cluttering common code?

Yes. I'd thought there were other uses of need_iommu but in fact they are all in x86.

And even if there were, you'd want them to resolve to 0 too until you have an IOMMU implementation.

Jan

#21 lore raw

PATCH 10/12 arm: stub out PoD

In reply to Ian Campbell
---
 xen/arch/arm/dummy.S      |    2 --
 xen/include/asm-arm/mm.h  |    8 ++++++--
 xen/include/asm-arm/p2m.h |   11 +++++++----
 3 files changed, 13 insertions(+), 8 deletions(-)
xen/arch/arm/dummy.S +0 -2
index e858613..67edb35 100644
@@ -31,8 +31,6 @@ DUMMY(is_iomem_page);
 DUMMY(max_page);
 DUMMY(node_online_map);
 DUMMY(nr_irqs_gsi);
-DUMMY(p2m_pod_decrease_reservation);
-DUMMY(guest_physmap_mark_populate_on_demand);
 DUMMY(page_get_owner_and_reference);
 DUMMY(page_is_ram_type);
 DUMMY(per_cpu__cpu_core_mask);
xen/include/asm-arm/mm.h +6 -2
index f721c54..ebe09cf 100644
@@ -294,8 +294,12 @@ extern struct domain *dom_xen, *dom_io, *dom_cow;
 #define memguard_guard_stack(_p)       ((void)0)
 #define memguard_guard_range(_p,_l)    ((void)0)
 #define memguard_unguard_range(_p,_l)  ((void)0)
-int guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
-                                          unsigned int order);
+/*
+ * int guest_physmap_mark_populate_on_demand(struct domain *d,
+ *                                           unsigned long gfn,
+ *                                           unsigned int order)
+ */
+#define guest_physmap_mark_populate_on_demand(d, gfn, order) -ENOSYS /* No PoD on ARM */
 
 extern void put_page_type(struct page_info *page);
 static inline void put_page_and_type(struct page_info *page)
xen/include/asm-arm/p2m.h +7 -4
index aec52f7..723518d 100644
@@ -48,10 +48,13 @@ unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn);
 
 /* Call when decreasing memory reservation to handle PoD entries properly.
  * Will return '1' if all entries were handled and nothing more need be done.*/
-int
-p2m_pod_decrease_reservation(struct domain *d,
-                             xen_pfn_t gpfn,
-                             unsigned int order);
+ /* No PoD on ARM yet */
+/* int
+ * p2m_pod_decrease_reservation(struct domain *d,
+ *                              xen_pfn_t gpfn,
+ *                              unsigned int order);
+ */
+#define p2m_pod_decrease_reservation(d, gpfn, order) -ENOSYS
 
 /* Compatibility function exporting the old untyped interface */
 static inline unsigned long get_gfn_untyped(struct domain *d, unsigned long gpfn)
Signature · 1 line
1.7.2.5
#22 lore raw

Re: [PATCH 10/12] arm: stub out PoD

Could we have a proper stub function or a static inline rather than an #define?

Quoted 70 lines · Ian Campbell
---
 xen/arch/arm/dummy.S      |    2 --
 xen/include/asm-arm/mm.h  |    8 ++++++--
 xen/include/asm-arm/p2m.h |   11 +++++++----
 3 files changed, 13 insertions(+), 8 deletions(-)
xen/arch/arm/dummy.S +0 -2
index e858613..67edb35 100644
@@ -31,8 +31,6 @@ DUMMY(is_iomem_page);
 DUMMY(max_page);
 DUMMY(node_online_map);
 DUMMY(nr_irqs_gsi);
-DUMMY(p2m_pod_decrease_reservation);
-DUMMY(guest_physmap_mark_populate_on_demand);
 DUMMY(page_get_owner_and_reference);
 DUMMY(page_is_ram_type);
 DUMMY(per_cpu__cpu_core_mask);
xen/include/asm-arm/mm.h +6 -2
index f721c54..ebe09cf 100644
@@ -294,8 +294,12 @@ extern struct domain *dom_xen, *dom_io, *dom_cow;
 #define memguard_guard_stack(_p)       ((void)0)
 #define memguard_guard_range(_p,_l)    ((void)0)
 #define memguard_unguard_range(_p,_l)  ((void)0)
-int guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
-                                          unsigned int order);
+/*
+ * int guest_physmap_mark_populate_on_demand(struct domain *d,
+ *                                           unsigned long gfn,
+ *                                           unsigned int order)
+ */
+#define guest_physmap_mark_populate_on_demand(d, gfn, order) -ENOSYS /* No PoD on ARM */
 
 extern void put_page_type(struct page_info *page);
 static inline void put_page_and_type(struct page_info *page)
xen/include/asm-arm/p2m.h +7 -4
index aec52f7..723518d 100644
@@ -48,10 +48,13 @@ unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn);
 
 /* Call when decreasing memory reservation to handle PoD entries properly.
  * Will return '1' if all entries were handled and nothing more need be done.*/
-int
-p2m_pod_decrease_reservation(struct domain *d,
-                             xen_pfn_t gpfn,
-                             unsigned int order);
+ /* No PoD on ARM yet */
+/* int
+ * p2m_pod_decrease_reservation(struct domain *d,
+ *                              xen_pfn_t gpfn,
+ *                              unsigned int order);
+ */
+#define p2m_pod_decrease_reservation(d, gpfn, order) -ENOSYS
 
 /* Compatibility function exporting the old untyped interface */
 static inline unsigned long get_gfn_untyped(struct domain *d, unsigned long gpfn)
Signature · 7 lines
1.7.2.5


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
#23 lore raw

Re: [PATCH 10/12] arm: stub out PoD

Quoted 2 lines · Stefano Stabellini

Could we have a proper stub function or a static inline rather than an #define?

I tried that, it would require pulling in more headers etc. This is really just a stop gap until we implement enough p2m to support pod properly. I left the real prototypes in the comment for reference.

Ian.

Quoted 73 lines · Ian Campbell
Quoted 70 lines
---
 xen/arch/arm/dummy.S      |    2 --
 xen/include/asm-arm/mm.h  |    8 ++++++--
 xen/include/asm-arm/p2m.h |   11 +++++++----
 3 files changed, 13 insertions(+), 8 deletions(-)
xen/arch/arm/dummy.S +0 -2
index e858613..67edb35 100644
@@ -31,8 +31,6 @@ DUMMY(is_iomem_page);
 DUMMY(max_page);
 DUMMY(node_online_map);
 DUMMY(nr_irqs_gsi);
-DUMMY(p2m_pod_decrease_reservation);
-DUMMY(guest_physmap_mark_populate_on_demand);
 DUMMY(page_get_owner_and_reference);
 DUMMY(page_is_ram_type);
 DUMMY(per_cpu__cpu_core_mask);
xen/include/asm-arm/mm.h +6 -2
index f721c54..ebe09cf 100644
@@ -294,8 +294,12 @@ extern struct domain *dom_xen, *dom_io, *dom_cow;
 #define memguard_guard_stack(_p)       ((void)0)
 #define memguard_guard_range(_p,_l)    ((void)0)
 #define memguard_unguard_range(_p,_l)  ((void)0)
-int guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
-                                          unsigned int order);
+/*
+ * int guest_physmap_mark_populate_on_demand(struct domain *d,
+ *                                           unsigned long gfn,
+ *                                           unsigned int order)
+ */
+#define guest_physmap_mark_populate_on_demand(d, gfn, order) -ENOSYS /* No PoD on ARM */
 
 extern void put_page_type(struct page_info *page);
 static inline void put_page_and_type(struct page_info *page)
xen/include/asm-arm/p2m.h +7 -4
index aec52f7..723518d 100644
@@ -48,10 +48,13 @@ unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn);
 
 /* Call when decreasing memory reservation to handle PoD entries properly.
  * Will return '1' if all entries were handled and nothing more need be done.*/
-int
-p2m_pod_decrease_reservation(struct domain *d,
-                             xen_pfn_t gpfn,
-                             unsigned int order);
+ /* No PoD on ARM yet */
+/* int
+ * p2m_pod_decrease_reservation(struct domain *d,
+ *                              xen_pfn_t gpfn,
+ *                              unsigned int order);
+ */
+#define p2m_pod_decrease_reservation(d, gpfn, order) -ENOSYS
 
 /* Compatibility function exporting the old untyped interface */
 static inline unsigned long get_gfn_untyped(struct domain *d, unsigned long gpfn)
Signature · 7 lines
1.7.2.5


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
#24 lore raw

Re: [PATCH 10/12] arm: stub out PoD

Quoted 7 lines · Ian Campbell
Quoted 2 lines · Stefano Stabellini

Could we have a proper stub function or a static inline rather than an #define?

I tried that, it would require pulling in more headers etc. This is really just a stop gap until we implement enough p2m to support pod properly. I left the real prototypes in the comment for reference.

We could just as easily have

static inline int
guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
unsigned int order)

{
    return -ENOSYS;
}

&c, for no extra effort (and for the same effect). A matter of style is all.

Tim.

#25 lore raw

Re: [PATCH 10/12] arm: stub out PoD

Quoted 14 lines · Tim Deegan
Quoted 7 lines · Ian Campbell
Quoted 2 lines · Stefano Stabellini

Could we have a proper stub function or a static inline rather than an #define?

I tried that, it would require pulling in more headers etc. This is really just a stop gap until we implement enough p2m to support pod properly. I left the real prototypes in the comment for reference.

We could just as easily have

static inline int
guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
unsigned int order)

Quoted 6 lines
{
    return -ENOSYS;
}

&c, for no extra effort (and for the same effect). A matter of style is all.

That is exactly what required pulling in more headers.

Ian.

#26 lore raw

PATCH 11/12 arm: define max_page

In reply to Ian Campbell
---
 xen/arch/arm/dummy.S |    1 -
 xen/arch/arm/mm.c    |    2 ++
 xen/arch/arm/setup.c |    2 ++
 3 files changed, 4 insertions(+), 1 deletions(-)
xen/arch/arm/dummy.S +0 -1
index 67edb35..295938e 100644
@@ -28,7 +28,6 @@ DUMMY(gnttab_clear_flag);
 DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
 DUMMY(is_iomem_page);
-DUMMY(max_page);
 DUMMY(node_online_map);
 DUMMY(nr_irqs_gsi);
 DUMMY(page_get_owner_and_reference);
xen/arch/arm/mm.c +2 -0
index 50c3634..4ec9788 100644
@@ -41,6 +41,8 @@ unsigned long xenheap_virt_end;
 
 unsigned long frametable_virt_end;
 
+unsigned long max_page;
+
 /* Map a 4k page in a fixmap entry */
 void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes)
 {
xen/arch/arm/setup.c +2 -0
index 2fcde24..b195813 100644
@@ -31,6 +31,7 @@
 #include <xen/softirq.h>
 #include <xen/keyhandler.h>
 #include <xen/cpu.h>
+#include <xen/pfn.h>
 #include <asm/page.h>
 #include <asm/current.h>
 #include <asm/setup.h>
@@ -122,6 +123,7 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     /* TODO Need to find actual memory, for now use 4GB at 512GB */
     setup_frametable_mappings(0x8000000000ULL, 0x8100000000UL);
+    max_page = PFN_DOWN(0x8100000000UL);
 
     /* Add xenheap memory */
     init_xenheap_pages(pfn_to_paddr(xenheap_mfn_start+1),
Signature · 1 line
1.7.2.5
#27 lore raw

PATCH 12/12 arm: Group remaining dummy symbols somewhat according to functionality

In reply to Ian Campbell

Makes it easier to see what needs to be done.

---
 xen/arch/arm/dummy.S |   71 +++++++++++++++++++++++++++++--------------------
 1 files changed, 42 insertions(+), 29 deletions(-)
xen/arch/arm/dummy.S +42 -29
index 295938e..1bf13a3 100644
@@ -5,49 +5,62 @@ x:	.word 0xe7f000f0 /* Undefined instruction */
 #define  NOP(x) \
 	.globl x; \
 x:	mov pc, lr
-	
+
+/* SMP support */
+DUMMY(__cpu_die);
+DUMMY(__cpu_disable);
+DUMMY(__cpu_up);
+DUMMY(per_cpu__cpu_core_mask);
+DUMMY(per_cpu__cpu_sibling_mask);
+DUMMY(node_online_map);
+DUMMY(smp_send_state_dump);
+DUMMY(__per_cpu_offset);
+
+/* PIRQ support */
 DUMMY(alloc_pirq_struct);
+DUMMY(nr_irqs_gsi);
+DUMMY(pirq_guest_bind);
+DUMMY(pirq_guest_unbind);
+DUMMY(pirq_set_affinity);
+
+/* VCPU */
 DUMMY(alloc_vcpu_guest_context);
 DUMMY(arch_get_info_guest);
 DUMMY(arch_set_info_guest);
 DUMMY(arch_vcpu_reset);
+DUMMY(free_vcpu_guest_context);
+DUMMY(sync_vcpu_execstate);
+NOP(update_vcpu_system_time);
+DUMMY(vcpu_mark_events_pending);
+DUMMY(vcpu_show_execution_state);
+
+/* Page Reference & Type Maintenance */
+DUMMY(get_page);
+DUMMY(get_page_type);
+DUMMY(page_get_owner_and_reference);
+DUMMY(put_page);
+DUMMY(put_page_type);
+
+/* Grant Tables */
 DUMMY(create_grant_host_mapping);
-DUMMY(__cpu_die);
-DUMMY(__cpu_disable);
-DUMMY(__cpu_up);
+DUMMY(gnttab_clear_flag);
+DUMMY(gnttab_mark_dirty);
+DUMMY(is_iomem_page);
+DUMMY(replace_grant_host_mapping);
+DUMMY(steal_page);
+
+/* Page Offlining */
+DUMMY(page_is_ram_type);
+
+/* Other */
 DUMMY(domain_get_maximum_gpfn);
 DUMMY(domain_relinquish_resources);
 DUMMY(domain_set_time_offset);
 DUMMY(dom_cow);
 DUMMY(flush_tlb_mask);
-DUMMY(free_vcpu_guest_context);
-DUMMY(get_page);
-DUMMY(get_page_type);
 DUMMY(gmfn_to_mfn);
-DUMMY(gnttab_clear_flag);
-DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
-DUMMY(is_iomem_page);
-DUMMY(node_online_map);
-DUMMY(nr_irqs_gsi);
-DUMMY(page_get_owner_and_reference);
-DUMMY(page_is_ram_type);
-DUMMY(per_cpu__cpu_core_mask);
-DUMMY(per_cpu__cpu_sibling_mask);
-DUMMY(__per_cpu_offset);
-DUMMY(pirq_guest_bind);
-DUMMY(pirq_guest_unbind);
-DUMMY(pirq_set_affinity);
-DUMMY(put_page);
-DUMMY(put_page_type);
-DUMMY(replace_grant_host_mapping);
 DUMMY(send_timer_event);
 DUMMY(share_xen_page_with_privileged_guests);
-DUMMY(smp_send_state_dump);
-DUMMY(steal_page);
-DUMMY(sync_vcpu_execstate);
 DUMMY(__udelay);
-NOP(update_vcpu_system_time);
-DUMMY(vcpu_mark_events_pending);
-DUMMY(vcpu_show_execution_state);
 DUMMY(wallclock_time);
Signature · 1 line
1.7.2.5
#28 lore raw
In reply to Ian Campbell
Quoted 6 lines · Ian Campbell

Defines a few stubs and disables some as yet unsupported core features.

Early on there's a couple of unrelated cleanups.

Patch against v5 posting (Stefano's arm-v5 branch) + David Vrables zImage series.

All fine by me but two comments.