|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v1 57/57] xxxen/riscv: WIP ( need advise )
On Wed, 2023-08-16 at 13:20 +0300, Oleksii Kurochko wrote:
> These changes are needed only to make GitLab CI happy is it doesn't
> take into account tiny64_defconfig where unnecessary configs are
> disabled.
>
> I tried different approaches to deal with it:
> 1. Override EXTRA_XEN_CONFIG and EXTRA_FIXED_RANDCONFIG in the
> following way:
> EXTRA_XEN_CONFIG:
> CONFIG_1=n
> CONFIG_2=n
> ...
> 2. Override in arch-specific KConfig:
> CONFIG_1:
> default n
>
> Each option doesn't work for me fully.
>
> Could you please suggest other options or more correct way?
>
It looks like if to do unwanted configs for now as an invisible config
in arch-specific KConfig it should work. Something like:
config GRANT_TABLE
bool
default n
I'll double-check tomorrow.
~ Oleksii
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
> ---
> xen/arch/riscv/include/asm/asm_defns.h | 44 +++++++++++++++++
> xen/arch/riscv/include/asm/grant_table.h | 57
> ++++++++++++++++++++++
> xen/arch/riscv/include/asm/guest_atomics.h | 16 +++++-
> xen/arch/riscv/include/asm/livepatch.h | 0
> xen/arch/riscv/include/asm/mm.h | 5 ++
> xen/arch/riscv/include/asm/p2m.h | 24 +++++++++
> xen/arch/riscv/include/asm/page.h | 16 ++++++
> xen/arch/riscv/include/asm/perfc_defn.h | 0
> xen/arch/riscv/mm.c | 33 +++++++++++++
> 9 files changed, 194 insertions(+), 1 deletion(-)
> create mode 100644 xen/arch/riscv/include/asm/asm_defns.h
> create mode 100644 xen/arch/riscv/include/asm/livepatch.h
> create mode 100644 xen/arch/riscv/include/asm/perfc_defn.h
>
> diff --git a/xen/arch/riscv/include/asm/asm_defns.h
> b/xen/arch/riscv/include/asm/asm_defns.h
> new file mode 100644
> index 0000000000..dd0511a9c6
> --- /dev/null
> +++ b/xen/arch/riscv/include/asm/asm_defns.h
> @@ -0,0 +1,44 @@
> +#ifndef __ARM_ASM_DEFNS_H__
> +#define __ARM_ASM_DEFNS_H__
> +
> +#ifndef COMPILE_OFFSETS
> +/* NB. Auto-generated from arch/.../asm-offsets.c */
> +#include <asm/asm-offsets.h>
> +#endif
> +#include <asm/processor.h>
> +
> +/* Macros for generic assembly code */
> +#if defined(CONFIG_RISCV_32)
> +# define __OP32
> +# define ASM_REG(index) asm("r" # index)
> +#elif defined(CONFIG_RISCV_64)
> +# define __OP32 "w"
> +/*
> + * Clang < 8.0 doesn't support register alllocation using the syntax
> rN.
> + * See https://reviews.llvm.org/rL328829.
> + */
> +# define ASM_REG(index) asm("x" # index)
> +#else
> +# error "unknown ARM variant"
> +#endif
> +
> +#define RODATA_STR(label, msg) \
> +.pushsection .rodata.str, "aMS", %progbits, 1 ; \
> +label: .asciz msg; \
> +.popsection
> +
> +#define ASM_INT(label, val) \
> + .p2align 2; \
> +label: .long (val); \
> + .size label, . - label; \
> + .type label, %object
> +
> +#endif /* __ARM_ASM_DEFNS_H__ */
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/xen/arch/riscv/include/asm/grant_table.h
> b/xen/arch/riscv/include/asm/grant_table.h
> index 600fb10669..8b7880d3ed 100644
> --- a/xen/arch/riscv/include/asm/grant_table.h
> +++ b/xen/arch/riscv/include/asm/grant_table.h
> @@ -1,4 +1,61 @@
> #ifndef __ASM_RISCV_GRANTTABLE_H__
> #define __ASM_RISCV_GRANTTABLE_H__
>
> +#define INITIAL_NR_GRANT_FRAMES 1U
> +
> +#define gnttab_shared_page(t, i) virt_to_page((t)->shared_raw[i])
> +
> +#define gnttab_status_page(t, i) virt_to_page((t)->status[i])
> +
> +#define gnttab_shared_gfn(d, t,
> i) \
> + page_get_xenheap_gfn(gnttab_shared_page(t, i))
> +
> +#define gnttab_status_gfn(d, t,
> i) \
> + page_get_xenheap_gfn(gnttab_status_page(t, i))
> +
> +#define gnttab_set_frame_gfn(gt, st, idx, gfn,
> mfn) \
> + (gfn_eq(gfn,
> INVALID_GFN) \
> + ? guest_physmap_remove_page((gt)-
> >domain, \
> + gnttab_get_frame_gfn(gt, st,
> idx), \
> + mfn,
> 0) \
> + : 0)
> +
> +#define gnttab_get_frame_gfn(gt, st, idx)
> ({ \
> + (st) ? gnttab_status_gfn(NULL, gt,
> idx) \
> + : gnttab_shared_gfn(NULL, gt,
> idx); \
> +})
> +
> +#define gnttab_need_iommu_mapping(d) \
> + (is_domain_direct_mapped(d) && is_iommu_enabled(d))
> +
> +static inline bool gnttab_release_host_mappings(const struct domain
> *d)
> +{
> + BUG();
> +}
> +
> +static inline void gnttab_mark_dirty(struct domain *d, mfn_t mfn)
> +{
> +#ifndef NDEBUG
> + printk_once(XENLOG_G_WARNING "gnttab_mark_dirty not implemented
> yet\n");
> +#endif
> +}
> +
> +static inline void gnttab_clear_flags(struct domain *d,
> + unsigned int mask, uint16_t
> *addr)
> +{
> + BUG();
> +}
> +
> +static inline bool gnttab_host_mapping_get_page_type(bool ro,
> + const struct
> domain *ld,
> + const struct
> domain *rd)
> +{
> + return false;
> +}
> +
> +int create_grant_host_mapping(uint64_t gpaddr, mfn_t frame,
> + unsigned int flags, unsigned int
> cache_flags);
> +int replace_grant_host_mapping(uint64_t gpaddr, mfn_t frame,
> + uint64_t new_gpaddr, unsigned int
> flags);
> +
> #endif /* __ASM_RISCV_GRANTTABLE_H__ */
> \ No newline at end of file
> diff --git a/xen/arch/riscv/include/asm/guest_atomics.h
> b/xen/arch/riscv/include/asm/guest_atomics.h
> index 71b0b11a25..8c8fd647d6 100644
> --- a/xen/arch/riscv/include/asm/guest_atomics.h
> +++ b/xen/arch/riscv/include/asm/guest_atomics.h
> @@ -35,9 +35,23 @@ guest_testop(test_and_change_bit)
>
> #undef guest_testop
>
> -
> #define guest_test_bit(d, nr, p) ((void)(d), test_bit(nr, p))
>
> +#define guest_cmpxchg(d, ptr, o, n) \
> + ((__typeof__(*(ptr)))__guest_cmpxchg(d, ptr, \
> + (unsigned long)(o),\
> + (unsigned long)(n),\
> + sizeof (*(ptr))))
> +
> +static always_inline unsigned long __guest_cmpxchg(struct domain *d,
> + volatile void
> *ptr,
> + unsigned long
> old,
> + unsigned long
> new,
> + unsigned int
> size)
> +{
> + BUG();
> +}
> +
> #endif /* __ASM_RISCV_GUEST_ATOMICS_H */
> /*
> * Local variables:
> diff --git a/xen/arch/riscv/include/asm/livepatch.h
> b/xen/arch/riscv/include/asm/livepatch.h
> new file mode 100644
> index 0000000000..e69de29bb2
> diff --git a/xen/arch/riscv/include/asm/mm.h
> b/xen/arch/riscv/include/asm/mm.h
> index 1d464afec9..37916f9be7 100644
> --- a/xen/arch/riscv/include/asm/mm.h
> +++ b/xen/arch/riscv/include/asm/mm.h
> @@ -276,4 +276,9 @@ void setup_initial_pagetables(void);
> void enable_mmu(void);
> void cont_after_mmu_is_enabled(void);
>
> +static inline gfn_t page_get_xenheap_gfn(const struct page_info *p)
> +{
> + BUG();
> +}
> +
> #endif /* _ASM_RISCV_MM_H */
> diff --git a/xen/arch/riscv/include/asm/p2m.h
> b/xen/arch/riscv/include/asm/p2m.h
> index 993aec6d2c..8537ce12fd 100644
> --- a/xen/arch/riscv/include/asm/p2m.h
> +++ b/xen/arch/riscv/include/asm/p2m.h
> @@ -29,6 +29,28 @@ typedef enum {
> p2m_max_real_type, /* Types after this won't be store in the
> p2m */
> } p2m_type_t;
>
> +/* We use bitmaps and mask to handle groups of types */
> +#define p2m_to_mask(_t) (1UL << (_t))
> +
> +/* RAM types, which map to real machine frames */
> +#define P2M_RAM_TYPES (p2m_to_mask(p2m_ram_rw) | \
> + p2m_to_mask(p2m_ram_ro))
> +
> +/* Grant mapping types, which map to a real frame in another VM */
> +#define P2M_GRANT_TYPES (p2m_to_mask(p2m_grant_map_rw) | \
> + p2m_to_mask(p2m_grant_map_ro))
> +
> +/* Foreign mappings types */
> +#define P2M_FOREIGN_TYPES (p2m_to_mask(p2m_map_foreign_rw) | \
> + p2m_to_mask(p2m_map_foreign_ro))
> +
> +/* Useful predicates */
> +#define p2m_is_ram(_t) (p2m_to_mask(_t) & P2M_RAM_TYPES)
> +#define p2m_is_foreign(_t) (p2m_to_mask(_t) & P2M_FOREIGN_TYPES)
> +#define p2m_is_any_ram(_t) (p2m_to_mask(_t) & \
> + (P2M_RAM_TYPES | P2M_GRANT_TYPES | \
> + P2M_FOREIGN_TYPES))
> +
> #include <xen/p2m-common.h>
>
> static inline int get_page_and_type(struct page_info *page,
> @@ -102,4 +124,6 @@ static inline void p2m_altp2m_check(struct vcpu
> *v, uint16_t idx)
> /* Not supported on RISCV. */
> }
>
> +bool is_iomem_page(mfn_t mfn);
> +
> #endif /* __ASM_RISCV_P2M_H__ */
> \ No newline at end of file
> diff --git a/xen/arch/riscv/include/asm/page.h
> b/xen/arch/riscv/include/asm/page.h
> index abbae75aaf..52eb517669 100644
> --- a/xen/arch/riscv/include/asm/page.h
> +++ b/xen/arch/riscv/include/asm/page.h
> @@ -83,6 +83,22 @@ static inline void flush_page_to_ram(unsigned long
> mfn, bool sync_icache)
> BUG();
> }
>
> +static inline int clean_dcache_va_range(const void *p, unsigned long
> size)
> +{
> + BUG();
> +}
> +
> +static inline int invalidate_dcache_va_range(const void *p, unsigned
> long size)
> +{
> + BUG();
> +}
> +
> +static inline int clean_and_invalidate_dcache_va_range
> + (const void *p, unsigned long size)
> +{
> + BUG();
> +}
> +
> #endif /* __ASSEMBLY__ */
>
> #endif /* _ASM_RISCV_PAGE_H */
> diff --git a/xen/arch/riscv/include/asm/perfc_defn.h
> b/xen/arch/riscv/include/asm/perfc_defn.h
> new file mode 100644
> index 0000000000..e69de29bb2
> diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
> index 0f40641db7..696a1e8448 100644
> --- a/xen/arch/riscv/mm.c
> +++ b/xen/arch/riscv/mm.c
> @@ -323,3 +323,36 @@ int map_pages_to_xen(unsigned long virt,
> assert_failed(__func__);
> return -1;
> }
> +
> +bool is_iomem_page(mfn_t mfn)
> +{
> + BUG();
> +}
> +
> +int replace_grant_host_mapping(uint64_t gpaddr, mfn_t frame,
> + uint64_t new_gpaddr, unsigned int
> flags)
> +{
> + BUG();
> +}
> +
> +int create_grant_host_mapping(uint64_t gpaddr, mfn_t frame,
> + unsigned int flags, unsigned int
> cache_flags)
> +{
> + BUG();
> +}
> +
> +struct domain *page_get_owner_and_reference(struct page_info *page)
> +{
> + BUG();
> +}
> +
> +void share_xen_page_with_guest(struct page_info *page, struct domain
> *d,
> + enum XENSHARE_flags flags)
> +{
> + BUG();
> +}
> +
> +bool get_page(struct page_info *page, const struct domain *domain)
> +{
> + BUG();
> +}
> \ No newline at end of file
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |