Message ID | 20200415010255.10081-2-sstabellini@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/12] xen: introduce xen_dom_flags | expand |
On 15.04.2020 03:02, Stefano Stabellini wrote: > --- a/xen/arch/arm/domain.c > +++ b/xen/arch/arm/domain.c > @@ -682,6 +682,7 @@ int arch_domain_create(struct domain *d, > return 0; > > ASSERT(config != NULL); > + d->arch.direct_map = flags != NULL ? flags->arch.is_direct_map : false; Shouldn't "true" here imply ->disable_migrate also getting set to true? Or is this already the case anyway for domains created right at boot? > --- a/xen/arch/arm/domain_build.c > +++ b/xen/arch/arm/domain_build.c > @@ -2527,6 +2527,7 @@ int __init construct_dom0(struct domain *d) > > iommu_hwdom_init(d); > > + d->arch.direct_map = true; Shouldn't this get set via arch_domain_create() instead? > --- a/xen/include/asm-x86/domain.h > +++ b/xen/include/asm-x86/domain.h > @@ -418,6 +418,8 @@ struct arch_domain > uint32_t emulation_flags; > } __cacheline_aligned; > > +struct arch_xen_dom_flags {}; This trivial x86 change Acked-by: Jan Beulich <jbeulich@suse.com> Jan
On 15/04/2020 11:27, Jan Beulich wrote: > On 15.04.2020 03:02, Stefano Stabellini wrote: >> --- a/xen/arch/arm/domain.c >> +++ b/xen/arch/arm/domain.c >> @@ -682,6 +682,7 @@ int arch_domain_create(struct domain *d, >> return 0; >> >> ASSERT(config != NULL); >> + d->arch.direct_map = flags != NULL ? flags->arch.is_direct_map : false; > Shouldn't "true" here imply ->disable_migrate also getting > set to true? Or is this already the case anyway for domains > created right at boot? Please don't introduce any more uses for disable_migrate. It is fundamentally broken and won't survive to 4.14 (assuming that the 30 odd patches of prereq fixes on xen-devel start unblocking themselves in time) ~Andrew
On Wed, 15 Apr 2020, Jan Beulich wrote: > > --- a/xen/arch/arm/domain_build.c > > +++ b/xen/arch/arm/domain_build.c > > @@ -2527,6 +2527,7 @@ int __init construct_dom0(struct domain *d) > > > > iommu_hwdom_init(d); > > > > + d->arch.direct_map = true; > > Shouldn't this get set via arch_domain_create() instead? Yes you are right, this is unnecessary and I can remove it.
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index b906a38b6b..59eae36de7 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -682,6 +682,7 @@ int arch_domain_create(struct domain *d, return 0; ASSERT(config != NULL); + d->arch.direct_map = flags != NULL ? flags->arch.is_direct_map : false; /* p2m_init relies on some value initialized by the IOMMU subsystem */ if ( (rc = iommu_domain_init(d, config->iommu_opts)) != 0 ) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 20e62a9fc4..2ec7453aa3 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2527,6 +2527,7 @@ int __init construct_dom0(struct domain *d) iommu_hwdom_init(d); + d->arch.direct_map = true; d->max_pages = ~0U; kinfo.unassigned_mem = dom0_mem; diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 9ccb3f7385..5434548e7b 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -787,7 +787,7 @@ void __init start_xen(unsigned long boot_phys_offset, .max_maptrack_frames = -1, }; int rc; - struct xen_dom_flags flags = { true }; + struct xen_dom_flags flags = { true, .arch.is_direct_map = true }; dcache_line_bytes = read_dcache_line_bytes(); diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index d39477a939..7a498921bf 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -32,7 +32,7 @@ enum domain_type { #endif /* The hardware domain has always its memory direct mapped. */ -#define is_domain_direct_mapped(d) ((d) == hardware_domain) +#define is_domain_direct_mapped(d) ((d)->arch.direct_map != false) struct vtimer { struct vcpu *v; @@ -98,8 +98,15 @@ struct arch_domain #ifdef CONFIG_TEE void *tee; #endif + + bool direct_map; } __cacheline_aligned; +struct arch_xen_dom_flags +{ + bool is_direct_map; +}; + struct arch_vcpu { struct { diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 105adf96eb..52199ed5b9 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -418,6 +418,8 @@ struct arch_domain uint32_t emulation_flags; } __cacheline_aligned; +struct arch_xen_dom_flags {}; + #ifdef CONFIG_HVM #define X86_EMU_LAPIC XEN_X86_EMU_LAPIC #define X86_EMU_HPET XEN_X86_EMU_HPET diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 4423e34500..7227e6ca98 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -65,6 +65,7 @@ void unmap_vcpu_info(struct vcpu *v); struct xen_dom_flags { bool is_priv; + struct arch_xen_dom_flags arch; }; int arch_domain_create(struct domain *d,
Introduce a new field in struct xen_dom_flags to store arch-specific flags. Add an ARM-specific flag to specify that the domain should be directly mapped (guest physical addresses == physical addresses). Also, add a direct_map flag under struct arch_domain and use it to implement is_domain_direct_mapped. Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> CC: andrew.cooper3@citrix.com CC: jbeulich@suse.com CC: George Dunlap <George.Dunlap@eu.citrix.com> CC: Ian Jackson <ian.jackson@eu.citrix.com> CC: Wei Liu <wl@xen.org> CC: "Roger Pau Monné" <roger.pau@citrix.com> --- xen/arch/arm/domain.c | 1 + xen/arch/arm/domain_build.c | 1 + xen/arch/arm/setup.c | 2 +- xen/include/asm-arm/domain.h | 9 ++++++++- xen/include/asm-x86/domain.h | 2 ++ xen/include/xen/domain.h | 1 + 6 files changed, 14 insertions(+), 2 deletions(-)