x86/pv: Unhide writes to d->arch.hv_compat_vstart
PATCH 1/1 x86/pv: Unhide writes to d->arch.hv_compat_vstart
The variable is never 0, but because the writes into it are hidden behind the HYPERVISOR_COMPAT_VIRT_START() macro, it does a good impression of appearing to be 0.
No functional change.
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Grygorii Strashko <[email protected]>
--- xen/arch/x86/domain.c | 2 +- xen/arch/x86/pv/dom0_build.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/domain.c +1 -1
@@ -891,7 +891,7 @@ int arch_domain_create(struct domain *d, d->arch.emulation_flags = emflags;#ifdef CONFIG_PV32 -HYPERVISOR_COMPAT_VIRT_START (d) = + d->arch.hv_compat_vstart =is_pv_domain (d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u ;#endif
xen/arch/x86/pv/dom0_build.c +1 -1
@@ -521,7 +521,7 @@ static int __init dom0_construct(const struct boot_domain *bd)printk ("Dom0 expects too high a hypervisor start address\n" );return -ERANGE ; } -HYPERVISOR_COMPAT_VIRT_START (d) = + d->arch.hv_compat_vstart = max_t(unsigned int, m2p_compat_vstart, value); }
base-commit: 63137a87311e1081bce0c5a4364492b4fc728bfb
Signature · 1 line
2.39.5
Hi Andrew,
Quoted 21 lines · Andrew Cooper
The variable is never 0, but because the writes into it are hidden behind the
HYPERVISOR_COMPAT_VIRT_START()macro, it does a good impression of appearing to be 0.No functional change.
Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Grygorii Strashko <[email protected]>--- xen/arch/x86/domain.c | 2 +- xen/arch/x86/pv/dom0_build.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)xen/arch/x86/domain.c +0
-0
xen/arch/x86/domain.c int arch_domain_create(struct domain *d, · line 896
Quoted 7 lines
xen/arch/x86/domain.c +1
-1@@ -891,7 +891,7 @@ int arch_domain_create(struct domain *d, d->arch.emulation_flags = emflags;#ifdef CONFIG_PV32 -HYPERVISOR_COMPAT_VIRT_START (d) = + d->arch.hv_compat_vstart =is_pv_domain (d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u ;#endif
Any chances it can be moved in pv_domain_initialise()?
xen/arch/x86/pv/dom0_build.c static int __init dom0_construct(const struct boot_domain *bd) · line 526
Quoted 13 lines
xen/arch/x86/pv/dom0_build.c +1
-1@@ -521,7 +521,7 @@ static int __init dom0_construct(const struct boot_domain *bd)printk ("Dom0 expects too high a hypervisor start address\n" );return -ERANGE ; } -HYPERVISOR_COMPAT_VIRT_START (d) = + d->arch.hv_compat_vstart = max_t(unsigned int, m2p_compat_vstart, value); }
Thank you.
Signature · 2 lines
Best regards, -grygorii
Quoted 6 lines · Grygorii Strashko
Quoted 5 lines · Andrew Cooper
xen/arch/x86/domain.c +0
-0@@ -891,7 +891,7 @@ int arch_domain_create(struct domain *d, d->arch.emulation_flags = emflags;
Quoted 7 lines
xen/arch/x86/domain.c int arch_domain_create(struct domain *d, · line 896
Quoted 5 lines
xen/arch/x86/domain.c +1
-1#ifdef CONFIG_PV32 -HYPERVISOR_COMPAT_VIRT_START (d) = + d->arch.hv_compat_vstart =is_pv_domain (d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u ;#endif Any chances it can be moved in
pv_domain_initialise()?
Probably, but one thing at a time? The field itself would also want to move from struct arch_domain to struct pv_domain, I think.
Jan
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Grygorii Strashko
Quoted 5 lines · Andrew Cooper
xen/arch/x86/domain.c +0
-0@@ -891,7 +891,7 @@ int arch_domain_create(struct domain *d, d->arch.emulation_flags = emflags;
Quoted 8 lines
Quoted 6 lines
xen/arch/x86/domain.c int arch_domain_create(struct domain *d, · line 896
Quoted 5 lines
xen/arch/x86/domain.c +1
-1#ifdef CONFIG_PV32 -HYPERVISOR_COMPAT_VIRT_START (d) = + d->arch.hv_compat_vstart =is_pv_domain (d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u ;#endif Any chances it can be moved in
pv_domain_initialise()?Probably, but one thing at a time? The field itself would also want to move from struct
arch_domainto structpv_domain, I think.
Agreed to one thing at a time.
The value itself is a total mess. Storage exists based on CONFIG_PV32, with 0 yielded in !PV32 builds.
Yet, in CONFIG_PV32 builds, it has the value 0xF5800000 for PV domains, and 0xFFFFFFFF for HVM domains.
This is nonsense, causing e.g. COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT() to return answers at opposite ends of the pagetable for non-PV32 VMs depending on CONFIG_PV32. I think this all works because the logic is behind suitable is_pv32_$FOO() checks, but it's far from clear.
It is only a PV32 dom0 which can have this set to anything besides 0xF5800000, so the "correct" thing to do would be to leave it 0 in domain create, and set it to 0xF5800000 in switch_compat(), along with the custom setup in dom0_construct().
But, lets get the d->arch.physaddr_bitsize adjustments sorted first before conflicting those with this change.
~Andrew
Quoted 7 lines · Andrew Cooper
The variable is never 0, but because the writes into it are hidden behind the
HYPERVISOR_COMPAT_VIRT_START()macro, it does a good impression of appearing to be 0.No functional change.
Signed-off-by Andrew Cooper <[email protected]>
I don't kind it being this way or the original one, so
Jan
Quoted 10 lines · Jan Beulich
Quoted 7 lines · Andrew Cooper
The variable is never 0, but because the writes into it are hidden behind the
HYPERVISOR_COMPAT_VIRT_START()macro, it does a good impression of appearing to be 0.No functional change.
Signed-off-by Andrew Cooper <[email protected]>I don't kind it being this way or the original one, so
Acked-by Jan Beulich <[email protected]>
Do you mean s/kind/mind/ ?
Thanks,
~Andrew
Quoted 6 lines · Andrew Cooper
Quoted 5 lines · Jan Beulich
Quoted 4 lines · Andrew Cooper
The variable is never 0, but because the writes into it are hidden behind the
HYPERVISOR_COMPAT_VIRT_START()macro, it does a good impression of appearing to be 0.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
No functional change.
Signed-off-by Andrew Cooper <[email protected]>I don't kind it being this way or the original one, so
Acked-by Jan Beulich <[email protected]>Do you mean s/kind/mind/ ?
Of course, sorry; must have hit the neighboring key.
Jan
Quoted 35 lines · Andrew Cooper
The variable is never 0, but because the writes into it are hidden behind the
HYPERVISOR_COMPAT_VIRT_START()macro, it does a good impression of appearing to be 0.No functional change.
Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Grygorii Strashko <[email protected]>--- xen/arch/x86/domain.c | 2 +- xen/arch/x86/pv/dom0_build.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)xen/arch/x86/domain.c +1
-1@@ -891,7 +891,7 @@ int arch_domain_create(struct domain *d, d->arch.emulation_flags = emflags;#ifdef CONFIG_PV32 -HYPERVISOR_COMPAT_VIRT_START (d) = + d->arch.hv_compat_vstart =is_pv_domain (d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u ;#endif xen/arch/x86/pv/dom0_build.c +0
-0
xen/arch/x86/pv/dom0_build.c static int __init dom0_construct(const struct boot_domain *bd) · line 527
Quoted 8 lines
xen/arch/x86/pv/dom0_build.c +1
-1@@ -521,7 +521,7 @@ static int __init dom0_construct(const struct boot_domain *bd)printk ("Dom0 expects too high a hypervisor start address\n" );return -ERANGE ; } -HYPERVISOR_COMPAT_VIRT_START (d) = + d->arch.hv_compat_vstart = max_t(unsigned int, m2p_compat_vstart, value); }
Thank you.
Signature · 2 lines
Best regards, -grygorii