Prerequisite patches for Arm64 MPU build
v4 cover Prerequisite patches for Arm64 MPU build
Hi all,
in order to build Xen for Arm64 with MPU support, there are few changes to support the compilation of Arm code without HAS_PASSTHROUGH and some Kconfig changes.
Luca Fancellu (2):
xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH xen/arm: Restrict Kconfig configuration for LLC coloring
xen/arch/arm/Kconfig | 2 +- xen/arch/arm/include/asm/grant_table.h | 5 +-- xen/include/xen/iommu.h | 50 +++++++++++++++++++++++++- 3 files changed, 53 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1
PATCH v4 1/2 xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH
When Xen is built without HAS_PASSTHROUGH, there are some parts in arm where iommu_* functions are called in the codebase, but their implementation is under xen/drivers/passthrough that is not built.
So provide some stub for these functions in order to build Xen when !HAS_PASSTHROUGH, which is the case for example on systems with MPU support.
For gnttab_need_iommu_mapping() in the Arm part, modify the macro to use IS_ENABLED for the HAS_PASSTHROUGH Kconfig.
---
v4 changes:
- re-introduced stub for iommu_use_hap_pt, Stefano suggested it is ok to have it in iommu.h.
- Reworded comment in iommu_domain_init from Jan suggestion
v3 Changes:
- removed stub for iommu_use_hap_pt, another solution will be done for the instance in common arm code.
- Moved a comment close to the macro it was referred to
- add comment to iommu_domain_init() stub
- modified commit message
- Add fixes tag
v2 Changes:
- modify gnttab_need_iommu_mapping to use IS_ENABLED
- removed macro that didn't allow some of the parameter to be evaluated
- Changed commit message
---
--- xen/arch/arm/include/asm/grant_table.h | 5 +-- xen/include/xen/iommu.h | 50 +++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 3 deletions(-)
xen/arch/arm/include/asm/grant_table.h +3 -2
@@ -73,8 +73,9 @@ int replace_grant_host_mapping(uint64_t gpaddr, mfn_t frame,#define gnttab_status_gfn (d, t, i) \ page_get_xenheap_gfn(gnttab_status_page(t, i)) -#define gnttab_need_iommu_mapping (d) \ - (is_domain_direct_mapped(d) && is_iommu_enabled(d)) +#define gnttab_need_iommu_mapping (d) \ + (IS_ENABLED(CONFIG_HAS_PASSTHROUGH) && is_domain_direct_mapped(d) && \ + is_iommu_enabled(d))#endif /* __ASM_GRANT_TABLE_H__ */ /*
xen/include/xen/iommu.h +49 -1
90 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v4 1/2] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH
Hi Luca,
Quoted 111 lines · Luca Fancellu
When Xen is built without
HAS_PASSTHROUGH, there are some parts in arm where iommu_* functions are called in the codebase, but their implementation is under xen/drivers/passthrough that is not built.So provide some stub for these functions in order to build Xen when !HAS_PASSTHROUGH, which is the case for example on systems with MPU support.
For
gnttab_need_iommu_mapping()in the Arm part, modify the macro to useIS_ENABLEDfor theHAS_PASSTHROUGHKconfig.Fixes 0388a5979b21 ("xen/arm: mpu: Introduce choice between MMU and MPU")Signed-off-by Luca Fancellu <[email protected]>---
v4 changes:
- re-introduced stub foriommu_use_hap_pt, Stefano suggested it is ok to have it iniommu.h.
- Reworded comment iniommu_domain_initfrom Jan suggestionv3 Changes:
- removed stub foriommu_use_hap_pt, another solution will be done for the instance in common arm code.
- Moved a comment close to the macro it was referred to
- add comment toiommu_domain_init()stub
- modified commit message
- Add fixes tagv2 Changes:
- modifygnttab_need_iommu_mappingto useIS_ENABLED
- removed macro that didn't allow some of the parameter to be evaluated
- Changed commit message
------ xen/arch/arm/include/asm/grant_table.h | 5 +-- xen/include/xen/iommu.h | 50 +++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 3 deletions(-)xen/arch/arm/include/asm/grant_table.h +3
-2@@ -73,8 +73,9 @@ int replace_grant_host_mapping(uint64_t gpaddr, mfn_t frame,#define gnttab_status_gfn (d, t, i) \ page_get_xenheap_gfn(gnttab_status_page(t, i)) -#define gnttab_need_iommu_mapping (d) \ - (is_domain_direct_mapped(d) && is_iommu_enabled(d)) +#define gnttab_need_iommu_mapping (d) \ + (IS_ENABLED(CONFIG_HAS_PASSTHROUGH) && is_domain_direct_mapped(d) && \ + is_iommu_enabled(d))#endif /* __ASM_GRANT_TABLE_H__ */ /* xen/include/xen/iommu.h +27
-0@@ -110,6 +110,8 @@ extern int8_t iommu_hwdom_reserved;extern unsigned int iommu_dev_iotlb_timeout; +#ifdef CONFIG_HAS_PASSTHROUGH +int iommu_setup (void );int iommu_hardware_setup (void );@@ -122,6 +124,28 @@ int arch_iommu_domain_init(struct domain *d);void arch_iommu_check_autotranslated_hwdom (struct domain *d);void arch_iommu_hwdom_init (struct domain *d); +#else + +static inline int iommu_setup (void ) +{ +return -ENODEV ; +} + +static inline int iommu_domain_init (struct domain *d,unsigned int opts) +{ +/* +* Return as the real iommu_domain_init() would: Success when +* !is_iommu_enabled(), following from !iommu_enabled when !HAS_PASSTHROUGH +*/ +return 0 ; +} + +static inline void iommu_hwdom_init (struct domain *d) {} + +static inline void iommu_domain_destroy (struct domain *d) {} + +#endif /* HAS_PASSTHROUGH */ +/* * The following flags are passed to map (applicable ones also to unmap) * operations, while some are passed back by lookup operations. @@ -209,6 +233,8 @@ struct msi_msg;#ifdef CONFIG_HAS_DEVICE_TREE #include <xen/device_tree.h> +#ifdef CONFIG_HAS_PASSTHROUGH +int iommu_assign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_deassign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_dt_domain_init (struct domain *d);@@ -238,6 +264,26 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,*/ int iommu_remove_dt_device (struct dt_device_node *np); +#else
xen/include/xen/iommu.h int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d, · line 277
Quoted 10 lines
xen/include/xen/iommu.h +10
-0+ +static inline int iommu_assign_dt_device (struct domain *d, +struct dt_device_node *dev) +{ +return -EINVAL ; +} + +static inline int iommu_add_dt_device (struct dt_device_node *np) +{ +return 1 ;
I would suggest to add a comment explain what 1 means. IIRC, this means "no iommu" present.
Other than that:
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH v4 1/2] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH
Hi Julien,
Quoted 106 lines · Julien Grall
Hi Luca,
Quoted 101 lines · Luca Fancellu
When Xen is built without
HAS_PASSTHROUGH, there are some parts in arm where iommu_* functions are called in the codebase, but their implementation is under xen/drivers/passthrough that is not built.
So provide some stub for these functions in order to build Xen when !HAS_PASSTHROUGH, which is the case for example on systems with MPU support.
Forgnttab_need_iommu_mapping()in the Arm part, modify the macro to useIS_ENABLEDfor theHAS_PASSTHROUGHKconfig.Fixes 0388a5979b21 ("xen/arm: mpu: Introduce choice between MMU and MPU")Signed-off-by Luca Fancellu <[email protected]>---
v4 changes:
- re-introduced stub foriommu_use_hap_pt, Stefano suggested it is ok to have it iniommu.h.
- Reworded comment iniommu_domain_initfrom Jan suggestion
v3 Changes:
- removed stub foriommu_use_hap_pt, another solution will be done for the instance in common arm code.
- Moved a comment close to the macro it was referred to
- add comment toiommu_domain_init()stub
- modified commit message
- Add fixes tag
v2 Changes:
- modifygnttab_need_iommu_mappingto useIS_ENABLED
- removed macro that didn't allow some of the parameter to be evaluated
- Changed commit message
------ xen/arch/arm/include/asm/grant_table.h | 5 +-- xen/include/xen/iommu.h | 50 +++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 3 deletions(-)xen/arch/arm/include/asm/grant_table.h +3
-1@@ -73,8 +73,9 @@ int replace_grant_host_mapping(uint64_t gpaddr, mfn_t frame,#define gnttab_status_gfn (d, t, i) \ page_get_xenheap_gfn(gnttab_status_page(t, i)) -#define gnttab_need_iommu_mapping(d) \ - (is_domain_direct_mapped(d) && is_iommu_enabled(d)) +#define gnttab_need_iommu_mapping(d) \ + (IS_ENABLED(CONFIG_HAS_PASSTHROUGH) && is_domain_direct_mapped(d) && \ + is_iommu_enabled(d))#endif /* __ASM_GRANT_TABLE_H__ */ /* xen/include/xen/iommu.h +27
-0@@ -110,6 +110,8 @@ extern int8_t iommu_hwdom_reserved;extern unsigned int iommu_dev_iotlb_timeout; +#ifdef CONFIG_HAS_PASSTHROUGH +int iommu_setup (void );int iommu_hardware_setup (void ); @@ -122,6 +124,28 @@ int arch_iommu_domain_init(struct domain *d);void arch_iommu_check_autotranslated_hwdom (struct domain *d);void arch_iommu_hwdom_init (struct domain *d); +#else + +static inline int iommu_setup (void ) +{ +return -ENODEV ; +} + +static inline int iommu_domain_init (struct domain *d,unsigned int opts) +{ +/* +* Return as the real iommu_domain_init() would: Success when +* !is_iommu_enabled(), following from !iommu_enabled when !HAS_PASSTHROUGH +*/ +return 0 ; +} + +static inline void iommu_hwdom_init (struct domain *d) {} + +static inline void iommu_domain_destroy (struct domain *d) {} + +#endif /* HAS_PASSTHROUGH */ +/* * The following flags are passed to map (applicable ones also to unmap) * operations, while some are passed back by lookup operations. @@ -209,6 +233,8 @@ struct msi_msg;#ifdef CONFIG_HAS_DEVICE_TREE #include <xen/device_tree.h> +#ifdef CONFIG_HAS_PASSTHROUGH +int iommu_assign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_deassign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_dt_domain_init (struct domain *d);@@ -238,6 +264,26 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,*/ int iommu_remove_dt_device (struct dt_device_node *np); +#else + +static inline int iommu_assign_dt_device (struct domain *d, +struct dt_device_node *dev) +{
Quoted 8 lines
xen/include/xen/iommu.h int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d, · line 277
Quoted 6 lines
xen/include/xen/iommu.h +6
-0+return -EINVAL ; +} + +static inline int iommu_add_dt_device (struct dt_device_node *np) +{ +return 1 ;I would suggest to add a comment explain what 1 means. IIRC, this means "no iommu" present.
Would it be ok something like in iommu_domain_init:
/*
* Returns as the real iommu_add_dt_device() would: Error “no iommu" because
* !iommu_enabled due to the fact that !HAS_PASSTHROUGH
*/
Quoted 10 lines
Other than that:
Acked-by Julien Grall <[email protected]>Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH v4 1/2] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH
Quoted 29 lines · Luca Fancellu
Quoted 20 lines · Julien Grall
Quoted 19 lines
/*
* The following flags are passed to map (applicable ones also to unmap)
* operations, while some are passed back by lookup operations.xen/include/xen/iommu.h +5
-0@@ -209,6 +233,8 @@ struct msi_msg;#ifdef CONFIG_HAS_DEVICE_TREE #include <xen/device_tree.h> +#ifdef CONFIG_HAS_PASSTHROUGH +int iommu_assign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_deassign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_dt_domain_init (struct domain *d);@@ -238,6 +264,26 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,*/ int iommu_remove_dt_device (struct dt_device_node *np); +#else + +static inline int iommu_assign_dt_device (struct domain *d, +struct dt_device_node *dev) +{Quoted 8 lines
xen/include/xen/iommu.h int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d, · line 277
Quoted 6 lines
xen/include/xen/iommu.h +6
-0+return -EINVAL ; +} + +static inline int iommu_add_dt_device (struct dt_device_node *np) +{ +return 1 ;I would suggest to add a comment explain what 1 means. IIRC, this means "no iommu" present.
Quoted 6 lines
Would it be ok something like in
iommu_domain_init:/*
* Returns as the realiommu_add_dt_device()would: Error “no iommu" because
* !iommu_enabled due to the fact that !HAS_PASSTHROUGH
*/
That's fine with me. The iommu code is technically maintained by Jan, so I will wait for him to confirm he is fine with the patch before committing.
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH v4 1/2] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH
In reply to Luca FancelluQuoted 117 lines · Luca Fancellu
Hi Julien,
Quoted 106 lines · Julien Grall
Hi Luca,
Quoted 101 lines · Luca Fancellu
When Xen is built without
HAS_PASSTHROUGH, there are some parts in arm where iommu_* functions are called in the codebase, but their implementation is under xen/drivers/passthrough that is not built.
So provide some stub for these functions in order to build Xen when !HAS_PASSTHROUGH, which is the case for example on systems with MPU support.
Forgnttab_need_iommu_mapping()in the Arm part, modify the macro to useIS_ENABLEDfor theHAS_PASSTHROUGHKconfig.Fixes 0388a5979b21 ("xen/arm: mpu: Introduce choice between MMU and MPU")Signed-off-by Luca Fancellu <[email protected]>---
v4 changes:
- re-introduced stub foriommu_use_hap_pt, Stefano suggested it is ok to have it iniommu.h.
- Reworded comment iniommu_domain_initfrom Jan suggestion
v3 Changes:
- removed stub foriommu_use_hap_pt, another solution will be done for the instance in common arm code.
- Moved a comment close to the macro it was referred to
- add comment toiommu_domain_init()stub
- modified commit message
- Add fixes tag
v2 Changes:
- modifygnttab_need_iommu_mappingto useIS_ENABLED
- removed macro that didn't allow some of the parameter to be evaluated
- Changed commit message
------ xen/arch/arm/include/asm/grant_table.h | 5 +-- xen/include/xen/iommu.h | 50 +++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 3 deletions(-)xen/arch/arm/include/asm/grant_table.h +3
-1@@ -73,8 +73,9 @@ int replace_grant_host_mapping(uint64_t gpaddr, mfn_t frame,#define gnttab_status_gfn (d, t, i) \ page_get_xenheap_gfn(gnttab_status_page(t, i)) -#define gnttab_need_iommu_mapping(d) \ - (is_domain_direct_mapped(d) && is_iommu_enabled(d)) +#define gnttab_need_iommu_mapping(d) \ + (IS_ENABLED(CONFIG_HAS_PASSTHROUGH) && is_domain_direct_mapped(d) && \ + is_iommu_enabled(d))#endif /* __ASM_GRANT_TABLE_H__ */ /* xen/include/xen/iommu.h +27
-0@@ -110,6 +110,8 @@ extern int8_t iommu_hwdom_reserved;extern unsigned int iommu_dev_iotlb_timeout; +#ifdef CONFIG_HAS_PASSTHROUGH +int iommu_setup (void );int iommu_hardware_setup (void ); @@ -122,6 +124,28 @@ int arch_iommu_domain_init(struct domain *d);void arch_iommu_check_autotranslated_hwdom (struct domain *d);void arch_iommu_hwdom_init (struct domain *d); +#else + +static inline int iommu_setup (void ) +{ +return -ENODEV ; +} + +static inline int iommu_domain_init (struct domain *d,unsigned int opts) +{ +/* +* Return as the real iommu_domain_init() would: Success when +* !is_iommu_enabled(), following from !iommu_enabled when !HAS_PASSTHROUGH +*/ +return 0 ; +} + +static inline void iommu_hwdom_init (struct domain *d) {} + +static inline void iommu_domain_destroy (struct domain *d) {} + +#endif /* HAS_PASSTHROUGH */ +/* * The following flags are passed to map (applicable ones also to unmap) * operations, while some are passed back by lookup operations. @@ -209,6 +233,8 @@ struct msi_msg;#ifdef CONFIG_HAS_DEVICE_TREE #include <xen/device_tree.h> +#ifdef CONFIG_HAS_PASSTHROUGH +int iommu_assign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_deassign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_dt_domain_init (struct domain *d);@@ -238,6 +264,26 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,*/ int iommu_remove_dt_device (struct dt_device_node *np); +#else + +static inline int iommu_assign_dt_device (struct domain *d, +struct dt_device_node *dev) +{Quoted 8 lines
xen/include/xen/iommu.h int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d, · line 277
Quoted 6 lines
xen/include/xen/iommu.h +6
-0+return -EINVAL ; +} + +static inline int iommu_add_dt_device (struct dt_device_node *np) +{ +return 1 ;I would suggest to add a comment explain what 1 means. IIRC, this means "no iommu" present.
Quoted 6 lines
Would it be ok something like in
iommu_domain_init:/*
* Returns as the realiommu_add_dt_device()would: Error “no iommu" because
* !iommu_enabled due to the fact that !HAS_PASSTHROUGH
*/
We had been there before, hadn't we? Personally I find the suggested text hard to follow. How about
/*
* !HAS_PASSTHROUGH => !iommu_enabled (see the non-stub
* iommu_add_dt_device())
*/
If that's too terse, adding a few words should be fine.
Jan
Re: [PATCH v4 1/2] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH
Hi Jan,
Quoted 46 lines
Quoted 46 lines
Quoted 35 lines
Quoted 35 lines
xen/include/xen/iommu.h +16
-0+ +static inline int iommu_domain_init (struct domain *d,unsigned int opts) +{ +/* +* Return as the real iommu_domain_init() would: Success when +* !is_iommu_enabled(), following from !iommu_enabled when !HAS_PASSTHROUGH +*/ +return 0 ; +} + +static inline void iommu_hwdom_init (struct domain *d) {} + +static inline void iommu_domain_destroy (struct domain *d) {} + +#endif /* HAS_PASSTHROUGH */ +/*
* The following flags are passed to map (applicable ones also to unmap)
* operations, while some are passed back by lookup operations.xen/include/xen/iommu.h +7
-0@@ -209,6 +233,8 @@ struct msi_msg;#ifdef CONFIG_HAS_DEVICE_TREE #include <xen/device_tree.h> +#ifdef CONFIG_HAS_PASSTHROUGH +int iommu_assign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_deassign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_dt_domain_init (struct domain *d);@@ -238,6 +264,26 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,*/ int iommu_remove_dt_device (struct dt_device_node *np); +#else + +static inline int iommu_assign_dt_device (struct domain *d, +struct dt_device_node *dev) +{Quoted 8 lines
xen/include/xen/iommu.h int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d, · line 277
Quoted 6 lines
xen/include/xen/iommu.h +6
-0+return -EINVAL ; +} + +static inline int iommu_add_dt_device (struct dt_device_node *np) +{ +return 1 ;I would suggest to add a comment explain what 1 means. IIRC, this means "no iommu" present.
Would it be ok something like in
iommu_domain_init:
Quoted 7 lines
Quoted 4 lines
/*
* Returns as the realiommu_add_dt_device()would: Error “no iommu" because
* !iommu_enabled due to the fact that !HAS_PASSTHROUGH
*/We had been there before, hadn't we? Personally I find the suggested text hard to follow.
well, I’ve taken your suggestion for iommu_domain_init and adapted here, maybe the adaptation didn’t meet your criteria then :)
But ...
Quoted 8 lines
How about
/*
* !HAS_PASSTHROUGH => !iommu_enabled (see the non-stub
*iommu_add_dt_device())
*/If that's too terse, adding a few words should be fine.
as long as you are happy with that, I’m happy as well, please let me know if you want a v5 with this or if you would do the modificaiton on commit.
Cheers,
Luca
Re: [PATCH v4 1/2] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH
Quoted 51 lines · Luca Fancellu
Quoted 51 lines
Quoted 50 lines
Quoted 35 lines
Quoted 35 lines
xen/include/xen/iommu.h +16
-0+ +static inline int iommu_domain_init (struct domain *d,unsigned int opts) +{ +/* +* Return as the real iommu_domain_init() would: Success when +* !is_iommu_enabled(), following from !iommu_enabled when !HAS_PASSTHROUGH +*/ +return 0 ; +} + +static inline void iommu_hwdom_init (struct domain *d) {} + +static inline void iommu_domain_destroy (struct domain *d) {} + +#endif /* HAS_PASSTHROUGH */ +/*
* The following flags are passed to map (applicable ones also to unmap)
* operations, while some are passed back by lookup operations.xen/include/xen/iommu.h +7
-0@@ -209,6 +233,8 @@ struct msi_msg;#ifdef CONFIG_HAS_DEVICE_TREE #include <xen/device_tree.h> +#ifdef CONFIG_HAS_PASSTHROUGH +int iommu_assign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_deassign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_dt_domain_init (struct domain *d);@@ -238,6 +264,26 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,*/ int iommu_remove_dt_device (struct dt_device_node *np); +#else + +static inline int iommu_assign_dt_device (struct domain *d, +struct dt_device_node *dev) +{Quoted 8 lines
xen/include/xen/iommu.h int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d, · line 277
Quoted 6 lines
xen/include/xen/iommu.h +6
-0+return -EINVAL ; +} + +static inline int iommu_add_dt_device (struct dt_device_node *np) +{ +return 1 ;I would suggest to add a comment explain what 1 means. IIRC, this means "no iommu" present.
Would it be ok something like in
iommu_domain_init:/*
* Returns as the realiommu_add_dt_device()would: Error “no iommu" because
* !iommu_enabled due to the fact that !HAS_PASSTHROUGH
*/
Quoted 5 lines
Quoted 2 lines
We had been there before, hadn't we? Personally I find the suggested text hard to follow.
well, I’ve taken your suggestion for
iommu_domain_initand adapted here, maybe the adaptation didn’t meet your criteria then :)
I wasn't overly happy with that other comment either.
Quoted 9 lines
But ...
Quoted 7 lines
How about
/*
* !HAS_PASSTHROUGH => !iommu_enabled (see the non-stub
*iommu_add_dt_device())
*/
Quoted 4 lines
Quoted 1 line
If that's too terse, adding a few words should be fine.
as long as you are happy with that, I’m happy as well, please let me know if you want a v5 with this or if you would do the modificaiton on commit.
I first need to get to looking at v4 as a whole.
Jan
Jan Beulich
Acked-byRe: [PATCH v4 1/2] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH
In reply to Julien GrallQuoted 128 lines · Julien Grall
Hi Luca,
Quoted 111 lines · Luca Fancellu
When Xen is built without
HAS_PASSTHROUGH, there are some parts in arm where iommu_* functions are called in the codebase, but their implementation is under xen/drivers/passthrough that is not built.So provide some stub for these functions in order to build Xen when !HAS_PASSTHROUGH, which is the case for example on systems with MPU support.
For
gnttab_need_iommu_mapping()in the Arm part, modify the macro to useIS_ENABLEDfor theHAS_PASSTHROUGHKconfig.Fixes 0388a5979b21 ("xen/arm: mpu: Introduce choice between MMU and MPU")Signed-off-by Luca Fancellu <[email protected]>---
v4 changes:
- re-introduced stub foriommu_use_hap_pt, Stefano suggested it is ok to have it iniommu.h.
- Reworded comment iniommu_domain_initfrom Jan suggestionv3 Changes:
- removed stub foriommu_use_hap_pt, another solution will be done for the instance in common arm code.
- Moved a comment close to the macro it was referred to
- add comment toiommu_domain_init()stub
- modified commit message
- Add fixes tagv2 Changes:
- modifygnttab_need_iommu_mappingto useIS_ENABLED
- removed macro that didn't allow some of the parameter to be evaluated
- Changed commit message
------ xen/arch/arm/include/asm/grant_table.h | 5 +-- xen/include/xen/iommu.h | 50 +++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 3 deletions(-)xen/arch/arm/include/asm/grant_table.h +3
-2@@ -73,8 +73,9 @@ int replace_grant_host_mapping(uint64_t gpaddr, mfn_t frame,#define gnttab_status_gfn (d, t, i) \ page_get_xenheap_gfn(gnttab_status_page(t, i)) -#define gnttab_need_iommu_mapping (d) \ - (is_domain_direct_mapped(d) && is_iommu_enabled(d)) +#define gnttab_need_iommu_mapping (d) \ + (IS_ENABLED(CONFIG_HAS_PASSTHROUGH) && is_domain_direct_mapped(d) && \ + is_iommu_enabled(d))#endif /* __ASM_GRANT_TABLE_H__ */ /* xen/include/xen/iommu.h +27
-0@@ -110,6 +110,8 @@ extern int8_t iommu_hwdom_reserved;extern unsigned int iommu_dev_iotlb_timeout; +#ifdef CONFIG_HAS_PASSTHROUGH +int iommu_setup (void );int iommu_hardware_setup (void );@@ -122,6 +124,28 @@ int arch_iommu_domain_init(struct domain *d);void arch_iommu_check_autotranslated_hwdom (struct domain *d);void arch_iommu_hwdom_init (struct domain *d); +#else + +static inline int iommu_setup (void ) +{ +return -ENODEV ; +} + +static inline int iommu_domain_init (struct domain *d,unsigned int opts) +{ +/* +* Return as the real iommu_domain_init() would: Success when +* !is_iommu_enabled(), following from !iommu_enabled when !HAS_PASSTHROUGH +*/ +return 0 ; +} + +static inline void iommu_hwdom_init (struct domain *d) {} + +static inline void iommu_domain_destroy (struct domain *d) {} + +#endif /* HAS_PASSTHROUGH */ +/* * The following flags are passed to map (applicable ones also to unmap) * operations, while some are passed back by lookup operations. @@ -209,6 +233,8 @@ struct msi_msg;#ifdef CONFIG_HAS_DEVICE_TREE #include <xen/device_tree.h> +#ifdef CONFIG_HAS_PASSTHROUGH +int iommu_assign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_deassign_dt_device (struct domain *d,struct dt_device_node *dev);int iommu_dt_domain_init (struct domain *d);@@ -238,6 +264,26 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,*/ int iommu_remove_dt_device (struct dt_device_node *np); +#else xen/include/xen/iommu.h int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d, · line 277
Quoted 10 lines
xen/include/xen/iommu.h +10
-0+ +static inline int iommu_assign_dt_device (struct domain *d, +struct dt_device_node *dev) +{ +return -EINVAL ; +} + +static inline int iommu_add_dt_device (struct dt_device_node *np) +{ +return 1 ;I would suggest to add a comment explain what 1 means. IIRC, this means "no iommu" present.
Quoted 3 lines
Other than that:
Acked-by Julien Grall <[email protected]>
Then also
Jan
PATCH v4 2/2 xen/arm: Restrict Kconfig configuration for LLC coloring
In reply to Luca FancelluXen LLC coloring feature can be used only on the MMU subsystem, move the code that selects it from ARM_64 to MMU and add the ARM_64 dependency.
---
v4 changes:
- clarified that it's the Xen feature LLC coloring that is not applicable to the MPU subsystem, not the generic cache coloring method.
- Add R-by Michal
v3 changes:
- Dropped comment on top of boot_fdt_info()
v2 changes:
- dropped part of the v1 code, now this one is simpler, I will discuss better how to design a common boot flow for MPU and implement on another patch.
---
--- xen/arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/Kconfig +1 -1
@@ -8,7 +8,6 @@ config ARM_64 depends on !ARM_32 select 64BIT select HAS_FAST_MULTIPLY - select HAS_LLC_COLORING if !NUMA config ARM def_bool y
@@ -76,6 +75,7 @@ choice config MMU bool "MMU" + select HAS_LLC_COLORING if !NUMA && ARM_64 select HAS_PMAP select HAS_VMAP select HAS_PASSTHROUGH
Signature · 1 line
2.34.1