xen/pvh: Dom0 support
Subsystems (5)
v2 cover xen/pvh: Dom0 support
Hello,
The following patches enable booting a PVH Dom0. So far I've only tested them in my test box, so I expect more issues will show up as this gets further testing. In any case, this is the bare minimum to get a PVH Dom0 working.
In order to test them Xen 4.11 RC or plain master/staging should be used. Compile a Linux kernel with this patches and PVH support and add dom0=pvh to the Xen command line. The following message will be displayed during Dom0 boot by the Linux kernel if PVH mode is used:
"Booting paravirtualized kernel on Xen PVH"
Thanks, Roger.
Roger Pau Monne (3):
xen/pvh: enable and set default MTRR type xen/store: do not store local values in xen_start_info
xen: share start flags between PV and PVH
arch/arm/xen/enlighten.c | 7 ++++--- arch/x86/xen/enlighten.c | 7 +++++++ arch/x86/xen/enlighten_pv.c | 1 + arch/x86/xen/enlighten_pvh.c | 4 ++++ drivers/xen/xenbus/xenbus_probe.c | 5 ++--- include/xen/xen.h | 4 +++- 6 files changed, 21 insertions(+), 7 deletions(-)
Signature · 1 line
2.17.0
PATCH v2 1/3 xen/pvh: enable and set default MTRR type
On PVH MTRR is not initialized by the firmware (because there's no firmware), so the kernel is started with MTRR disabled which means all memory accesses are UC.
So far there have been no issues (ie: slowdowns) caused by this because PVH only supported DomU mode without passed-through devices, so Xen was using WB as the default memory type instead of UC.
Fix this by enabling MTRR and setting the default type to WB. Linux will use PAT to set the actual memory cache attributes.
---
Cc: Boris Ostrovsky <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: [email protected]
--- arch/x86/xen/enlighten_pvh.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/xen/enlighten_pvh.c +3 -0
@@ -6,6 +6,7 @@#include <asm/io_apic.h> #include <asm/hypervisor.h> #include <asm/e820/api.h> +#include <asm/mtrr.h> #include <asm/x86_init.h> #include <asm/xen/interface.h>
@@ -98,6 +99,8 @@ void __init xen_prepare_pvh(void) xen_pvh =1 ; +wrmsr_safe (MSR_MTRRdefType,0x800 |MTRR_TYPE_WRBACK ,0 ); + msr =cpuid_ebx (xen_cpuid_base () +2 ); pfn =__pa (hypercall_page);wrmsr_safe (msr, (u32 )pfn, (u32)(pfn >>32 ));
Signature · 1 line
2.17.0
Re: [PATCH v2 1/3] xen/pvh: enable and set default MTRR type
Quoted 8 lines · Roger Pau Monne
On PVH MTRR is not initialized by the firmware (because there's no firmware), so the kernel is started with MTRR disabled which means all memory accesses are UC.
So far there have been no issues (ie: slowdowns) caused by this because PVH only supported DomU mode without passed-through devices, so Xen was using WB as the default memory type instead of UC.
Quoted 5 lines
Fix this by enabling MTRR and setting the default type to WB. Linux will use PAT to set the actual memory cache attributes.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
I'd argue that this is a bug in PVH starting state.
Do you know what mechanism is used to bodge things to WB in the first place? I'm not sure that setting the default MTRR type is going to be a clever idea in hindsight when we come to doing PCI Passthrough support.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 1/3] xen/pvh: enable and set default MTRR type
In reply to Roger Pau MonneQuoted 8 lines · Roger Pau Monne
On PVH MTRR is not initialized by the firmware (because there's no firmware), so the kernel is started with MTRR disabled which means all memory accesses are UC.
So far there have been no issues (ie: slowdowns) caused by this because PVH only supported DomU mode without passed-through devices, so Xen was using WB as the default memory type instead of UC.
Quoted 5 lines
Fix this by enabling MTRR and setting the default type to WB. Linux will use PAT to set the actual memory cache attributes.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
I'd argue that this is a bug in PVH starting state.
Do you know what mechanism is used to bodge things to WB in the first place? I'm not sure that setting the default MTRR type is going to be a clever idea in hindsight when we come to doing PCI Passthrough support.
~Andrew
Re: [Xen-devel] [PATCH v2 1/3] xen/pvh: enable and set default MTRR type
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Roger Pau Monne
On PVH MTRR is not initialized by the firmware (because there's no firmware), so the kernel is started with MTRR disabled which means all memory accesses are UC.
So far there have been no issues (ie: slowdowns) caused by this because PVH only supported DomU mode without passed-through devices, so Xen was using WB as the default memory type instead of UC.
Quoted 7 lines
Quoted 5 lines
Fix this by enabling MTRR and setting the default type to WB. Linux will use PAT to set the actual memory cache attributes.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>I'd argue that this is a bug in PVH starting state.
Do you mean that MTRR should be setup before starting the guest?
Quoted 2 lines
Do you know what mechanism is used to bodge things to WB in the first place?
If you mean when passthorugh is not used (ie: no IOMMU), then it's at epte_get_entry_emt, grep for need_iommu(d) (line ~801).
Quoted 2 lines
I'm not sure that setting the default MTRR type is going to be a clever idea in hindsight when we come to doing PCI Passthrough support.
Setting the default type to WB is also set by hvmloader, it's just that hvmloader also sets some of the fixed and variable ranges to UC in order to cover the iomem areas.
The expectations when doing pci-passthrough is that the guest will always use paging and PAT in order to set the appropriate cache attributes, or else the guest itself will have to program the UC MTRR ranges, I admit that's not very nice however.
What about enabling the default MTRR type and setting it to WB in the toolstack for PVH? IMO doing it Xen itself would be wrong.
Thanks, Roger.
Re: [Xen-devel] [PATCH v2 1/3] xen/pvh: enable and set default MTRR type
Quoted 9 lines · Roger Pau Monné
Quoted 3 lines · Andrew Cooper
On 09/05/18 11:21, Roger Pau Monne wrote:
I'm not sure that setting the default MTRR type is going to be a clever idea in hindsight when we come to doing PCI Passthrough support.Setting the default type to WB is also set by hvmloader, it's just that hvmloader also sets some of the fixed and variable ranges to UC in order to cover the iomem areas.
Quoted 7 lines
The expectations when doing pci-passthrough is that the guest will always use paging and PAT in order to set the appropriate cache attributes, or else the guest itself will have to program the UC MTRR ranges, I admit that's not very nice however.
What about enabling the default MTRR type and setting it to WB in the toolstack for PVH? IMO doing it Xen itself would be wrong.
I have the following patch to set the default MTRR type, but I think if we go down this road then we will also have to set UC MTRRs for MMIO areas, which again seems fine to me.
---8<---
tools/libxc/xc_dom_x86.c +11 -0
@@ -938,6 +938,8 @@ static int vcpu_hvm(struct xc_dom_image *dom)HVM_SAVE_TYPE (HEADER) header;struct hvm_save_descriptor cpu_d;HVM_SAVE_TYPE (CPU) cpu; +struct hvm_save_descriptor mtrr_d; +HVM_SAVE_TYPE (MTRR) mtrr;struct hvm_save_descriptor end_d;HVM_SAVE_TYPE (END) end; } bsp_ctx;
@@ -1014,6 +1016,15 @@ static int vcpu_hvm(struct xc_dom_image *dom)if ( dom->start_info_seg.pfn ) bsp_ctx.cpu.rbx = dom->start_info_seg.pfn <<PAGE_SHIFT ; +/* Set the MTRR. */ + bsp_ctx.mtrr_d.typecode =HVM_SAVE_CODE (MTRR ); + bsp_ctx.mtrr_d.instance =0 ; + bsp_ctx.mtrr_d.length =HVM_SAVE_LENGTH (MTRR ); +/* XXX: maybe this should be a firmware option instead? */ +if ( !dom->device_model ) +/* Enable MTRR (bit 11) and set the default type to WB (6). */ + bsp_ctx.mtrr.msr_mtrr_def_type = (1u <<11 ) |6 ; +/* Set the end descriptor. */ bsp_ctx.end_d.typecode =HVM_SAVE_CODE (END ); bsp_ctx.end_d.instance =0 ;
Re: [Xen-devel] [PATCH v2 1/3] xen/pvh: enable and set default MTRR type
Quoted 15 lines · Roger Pau Monné
Quoted 14 lines · Roger Pau Monné
Quoted 3 lines · Andrew Cooper
On 09/05/18 11:21, Roger Pau Monne wrote:
I'm not sure that setting the default MTRR type is going to be a clever idea in hindsight when we come to doing PCI Passthrough support.Setting the default type to WB is also set by hvmloader, it's just that hvmloader also sets some of the fixed and variable ranges to UC in order to cover the iomem areas.
The expectations when doing pci-passthrough is that the guest will always use paging and PAT in order to set the appropriate cache attributes, or else the guest itself will have to program the UC MTRR ranges, I admit that's not very nice however.
Quoted 7 lines
Quoted 2 lines
What about enabling the default MTRR type and setting it to WB in the toolstack for PVH? IMO doing it Xen itself would be wrong.
I have the following patch to set the default MTRR type, but I think if we go down this road then we will also have to set UC MTRRs for MMIO areas, which again seems fine to me.
Can you please document the default type(s) to pvh.markdown once the issue is resolved?
Wei.
Re: [PATCH v2 1/3] xen/pvh: enable and set default MTRR type
In reply to Roger Pau MonnéQuoted 15 lines · Roger Pau Monné
Quoted 14 lines · Roger Pau Monné
Quoted 3 lines · Andrew Cooper
On 09/05/18 11:21, Roger Pau Monne wrote:
I'm not sure that setting the default MTRR type is going to be a clever idea in hindsight when we come to doing PCI Passthrough support.Setting the default type to WB is also set by hvmloader, it's just that hvmloader also sets some of the fixed and variable ranges to UC in order to cover the iomem areas.
The expectations when doing pci-passthrough is that the guest will always use paging and PAT in order to set the appropriate cache attributes, or else the guest itself will have to program the UC MTRR ranges, I admit that's not very nice however.
Quoted 7 lines
Quoted 2 lines
What about enabling the default MTRR type and setting it to WB in the toolstack for PVH? IMO doing it Xen itself would be wrong.
I have the following patch to set the default MTRR type, but I think if we go down this road then we will also have to set UC MTRRs for MMIO areas, which again seems fine to me.
Can you please document the default type(s) to pvh.markdown once the issue is resolved?
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 1/3] xen/pvh: enable and set default MTRR type
In reply to Roger Pau MonnéQuoted 15 lines · Roger Pau Monné
Quoted 14 lines · Roger Pau Monné
Quoted 3 lines · Andrew Cooper
On 09/05/18 11:21, Roger Pau Monne wrote:
I'm not sure that setting the default MTRR type is going to be a clever idea in hindsight when we come to doing PCI Passthrough support.Setting the default type to WB is also set by hvmloader, it's just that hvmloader also sets some of the fixed and variable ranges to UC in order to cover the iomem areas.
The expectations when doing pci-passthrough is that the guest will always use paging and PAT in order to set the appropriate cache attributes, or else the guest itself will have to program the UC MTRR ranges, I admit that's not very nice however.
Quoted 6 lines
Quoted 2 lines
What about enabling the default MTRR type and setting it to WB in the toolstack for PVH? IMO doing it Xen itself would be wrong.
I have the following patch to set the default MTRR type, but I think if we go down this road then we will also have to set UC MTRRs for MMIO areas, which again seems fine to me.
I like this route much better.
Juergen
Quoted 33 lines
---8<---
tools/libxc/xc_dom_x86.c +11
-0@@ -938,6 +938,8 @@ static int vcpu_hvm(struct xc_dom_image *dom)HVM_SAVE_TYPE (HEADER) header;struct hvm_save_descriptor cpu_d;HVM_SAVE_TYPE (CPU) cpu; +struct hvm_save_descriptor mtrr_d; +HVM_SAVE_TYPE (MTRR) mtrr;struct hvm_save_descriptor end_d;HVM_SAVE_TYPE (END) end; } bsp_ctx;@@ -1014,6 +1016,15 @@ static int vcpu_hvm(struct xc_dom_image *dom)if ( dom->start_info_seg.pfn ) bsp_ctx.cpu.rbx = dom->start_info_seg.pfn <<PAGE_SHIFT ; +/* Set the MTRR. */ + bsp_ctx.mtrr_d.typecode =HVM_SAVE_CODE (MTRR ); + bsp_ctx.mtrr_d.instance =0 ; + bsp_ctx.mtrr_d.length =HVM_SAVE_LENGTH (MTRR ); +/* XXX: maybe this should be a firmware option instead? */ +if ( !dom->device_model ) +/* Enable MTRR (bit 11) and set the default type to WB (6). */ + bsp_ctx.mtrr.msr_mtrr_def_type = (1u <<11 ) |6 ; +/* Set the end descriptor. */ bsp_ctx.end_d.typecode =HVM_SAVE_CODE (END ); bsp_ctx.end_d.instance =0 ;
Juergen Gross
maintainerRe: [PATCH v2 1/3] xen/pvh: enable and set default MTRR type
In reply to Roger Pau MonnéQuoted 15 lines · Roger Pau Monné
Quoted 14 lines · Roger Pau Monné
Quoted 3 lines · Andrew Cooper
On 09/05/18 11:21, Roger Pau Monne wrote:
I'm not sure that setting the default MTRR type is going to be a clever idea in hindsight when we come to doing PCI Passthrough support.Setting the default type to WB is also set by hvmloader, it's just that hvmloader also sets some of the fixed and variable ranges to UC in order to cover the iomem areas.
The expectations when doing pci-passthrough is that the guest will always use paging and PAT in order to set the appropriate cache attributes, or else the guest itself will have to program the UC MTRR ranges, I admit that's not very nice however.
Quoted 6 lines
Quoted 2 lines
What about enabling the default MTRR type and setting it to WB in the toolstack for PVH? IMO doing it Xen itself would be wrong.
I have the following patch to set the default MTRR type, but I think if we go down this road then we will also have to set UC MTRRs for MMIO areas, which again seems fine to me.
I like this route much better.
Juergen
Quoted 23 lines
---8<---
tools/libxc/xc_dom_x86.c +4
-0@@ -938,6 +938,8 @@ static int vcpu_hvm(struct xc_dom_image *dom)HVM_SAVE_TYPE (HEADER) header;struct hvm_save_descriptor cpu_d;HVM_SAVE_TYPE (CPU) cpu; +struct hvm_save_descriptor mtrr_d; +HVM_SAVE_TYPE (MTRR) mtrr;struct hvm_save_descriptor end_d;HVM_SAVE_TYPE (END) end; } bsp_ctx;@@ -1014,6 +1016,15 @@ static int vcpu_hvm(struct xc_dom_image *dom)if ( dom->start_info_seg.pfn ) bsp_ctx.cpu.rbx = dom->start_info_seg.pfn <<PAGE_SHIFT ; +/* Set the MTRR. */ + bsp_ctx.mtrr_d.typecode =HVM_SAVE_CODE (MTRR );
tools/libxc/xc_dom_x86.c static int vcpu_hvm(struct xc_dom_image *dom) · line 1030
Quoted 10 lines
tools/libxc/xc_dom_x86.c +7
-0+ bsp_ctx.mtrr_d.instance =0 ; + bsp_ctx.mtrr_d.length =HVM_SAVE_LENGTH (MTRR ); +/* XXX: maybe this should be a firmware option instead? */ +if ( !dom->device_model ) +/* Enable MTRR (bit 11) and set the default type to WB (6). */ + bsp_ctx.mtrr.msr_mtrr_def_type = (1u <<11 ) |6 ; +/* Set the end descriptor. */ bsp_ctx.end_d.typecode =HVM_SAVE_CODE (END ); bsp_ctx.end_d.instance =0 ;
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 1/3] xen/pvh: enable and set default MTRR type
In reply to Roger Pau MonnéQuoted 9 lines · Roger Pau Monné
Quoted 3 lines · Andrew Cooper
On 09/05/18 11:21, Roger Pau Monne wrote:
I'm not sure that setting the default MTRR type is going to be a clever idea in hindsight when we come to doing PCI Passthrough support.Setting the default type to WB is also set by hvmloader, it's just that hvmloader also sets some of the fixed and variable ranges to UC in order to cover the iomem areas.
Quoted 7 lines
The expectations when doing pci-passthrough is that the guest will always use paging and PAT in order to set the appropriate cache attributes, or else the guest itself will have to program the UC MTRR ranges, I admit that's not very nice however.
What about enabling the default MTRR type and setting it to WB in the toolstack for PVH? IMO doing it Xen itself would be wrong.
I have the following patch to set the default MTRR type, but I think if we go down this road then we will also have to set UC MTRRs for MMIO areas, which again seems fine to me.
---8<---
tools/libxc/xc_dom_x86.c +11 -0
@@ -938,6 +938,8 @@ static int vcpu_hvm(struct xc_dom_image *dom)HVM_SAVE_TYPE (HEADER) header;struct hvm_save_descriptor cpu_d;HVM_SAVE_TYPE (CPU) cpu; +struct hvm_save_descriptor mtrr_d; +HVM_SAVE_TYPE (MTRR) mtrr;struct hvm_save_descriptor end_d;HVM_SAVE_TYPE (END) end; } bsp_ctx;
@@ -1014,6 +1016,15 @@ static int vcpu_hvm(struct xc_dom_image *dom)if ( dom->start_info_seg.pfn ) bsp_ctx.cpu.rbx = dom->start_info_seg.pfn <<PAGE_SHIFT ; +/* Set the MTRR. */ + bsp_ctx.mtrr_d.typecode =HVM_SAVE_CODE (MTRR ); + bsp_ctx.mtrr_d.instance =0 ; + bsp_ctx.mtrr_d.length =HVM_SAVE_LENGTH (MTRR ); +/* XXX: maybe this should be a firmware option instead? */ +if ( !dom->device_model ) +/* Enable MTRR (bit 11) and set the default type to WB (6). */ + bsp_ctx.mtrr.msr_mtrr_def_type = (1u <<11 ) |6 ; +/* Set the end descriptor. */ bsp_ctx.end_d.typecode =HVM_SAVE_CODE (END ); bsp_ctx.end_d.instance =0 ;
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 1/3] xen/pvh: enable and set default MTRR type
In reply to Andrew CooperQuoted 9 lines · Andrew Cooper
Quoted 8 lines · Roger Pau Monne
On PVH MTRR is not initialized by the firmware (because there's no firmware), so the kernel is started with MTRR disabled which means all memory accesses are UC.
So far there have been no issues (ie: slowdowns) caused by this because PVH only supported DomU mode without passed-through devices, so Xen was using WB as the default memory type instead of UC.
Quoted 7 lines
Quoted 5 lines
Fix this by enabling MTRR and setting the default type to WB. Linux will use PAT to set the actual memory cache attributes.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>I'd argue that this is a bug in PVH starting state.
Do you mean that MTRR should be setup before starting the guest?
Quoted 2 lines
Do you know what mechanism is used to bodge things to WB in the first place?
If you mean when passthorugh is not used (ie: no IOMMU), then it's at epte_get_entry_emt, grep for need_iommu(d) (line ~801).
Quoted 2 lines
I'm not sure that setting the default MTRR type is going to be a clever idea in hindsight when we come to doing PCI Passthrough support.
Setting the default type to WB is also set by hvmloader, it's just that hvmloader also sets some of the fixed and variable ranges to UC in order to cover the iomem areas.
The expectations when doing pci-passthrough is that the guest will always use paging and PAT in order to set the appropriate cache attributes, or else the guest itself will have to program the UC MTRR ranges, I admit that's not very nice however.
What about enabling the default MTRR type and setting it to WB in the toolstack for PVH? IMO doing it Xen itself would be wrong.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 1/3 xen/pvh: enable and set default MTRR type
In reply to Roger Pau MonneOn PVH MTRR is not initialized by the firmware (because there's no firmware), so the kernel is started with MTRR disabled which means all memory accesses are UC.
So far there have been no issues (ie: slowdowns) caused by this because PVH only supported DomU mode without passed-through devices, so Xen was using WB as the default memory type instead of UC.
Fix this by enabling MTRR and setting the default type to WB. Linux will use PAT to set the actual memory cache attributes.
---
Cc: Boris Ostrovsky <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: [email protected]
--- arch/x86/xen/enlighten_pvh.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/xen/enlighten_pvh.c +3 -0
@@ -6,6 +6,7 @@#include <asm/io_apic.h> #include <asm/hypervisor.h> #include <asm/e820/api.h> +#include <asm/mtrr.h> #include <asm/x86_init.h> #include <asm/xen/interface.h>
@@ -98,6 +99,8 @@ void __init xen_prepare_pvh(void) xen_pvh =1 ; +wrmsr_safe (MSR_MTRRdefType,0x800 |MTRR_TYPE_WRBACK ,0 ); + msr =cpuid_ebx (xen_cpuid_base () +2 ); pfn =__pa (hypercall_page);wrmsr_safe (msr, (u32 )pfn, (u32)(pfn >>32 ));
Signature · 7 lines
2.17.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 2/3 xen/store: do not store local values in xen_start_info
In reply to Roger Pau MonneThere's no need to store the xenstore page or event channel in xen_start_info if they are locally initialized.
This also fixes PVH local xenstore initialization due to the lack of xen_start_info in that case.
---
Cc: Boris Ostrovsky <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: [email protected]
--- drivers/xen/xenbus/xenbus_probe.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/xen/xenbus/xenbus_probe.c +2 -3
@@ -710,7 +710,7 @@ static int __init xenstored_local_init(void)if (!page) goto out_err; - xen_store_gfn = xen_start_info->store_mfn =virt_to_gfn ((void *)page); + xen_store_gfn =virt_to_gfn ((void *)page);/* Next allocate a local port which xenstored can bind to */ alloc_unbound.dom =DOMID_SELF ;
@@ -722,8 +722,7 @@ static int __init xenstored_local_init(void) goto out_err;BUG_ON (err); - xen_store_evtchn = xen_start_info->store_evtchn = - alloc_unbound.port; + xen_store_evtchn = alloc_unbound.port;return 0 ;
Signature · 7 lines
2.17.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 2/3 xen/store: do not store local values in xen_start_info
In reply to Roger Pau MonneThere's no need to store the xenstore page or event channel in xen_start_info if they are locally initialized.
This also fixes PVH local xenstore initialization due to the lack of xen_start_info in that case.
---
Cc: Boris Ostrovsky <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: [email protected]
--- drivers/xen/xenbus/xenbus_probe.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/xen/xenbus/xenbus_probe.c +2 -3
@@ -710,7 +710,7 @@ static int __init xenstored_local_init(void)if (!page) goto out_err; - xen_store_gfn = xen_start_info->store_mfn =virt_to_gfn ((void *)page); + xen_store_gfn =virt_to_gfn ((void *)page);/* Next allocate a local port which xenstored can bind to */ alloc_unbound.dom =DOMID_SELF ;
@@ -722,8 +722,7 @@ static int __init xenstored_local_init(void) goto out_err;BUG_ON (err); - xen_store_evtchn = xen_start_info->store_evtchn = - alloc_unbound.port; + xen_store_evtchn = alloc_unbound.port;return 0 ;
Signature · 1 line
2.17.0
Re: [PATCH v2 2/3] xen/store: do not store local values in xen_start_info
Quoted 8 lines · Roger Pau Monne
There's no need to store the xenstore page or event channel in
xen_start_infoif they are locally initialized.This also fixes PVH local xenstore initialization due to the lack of
xen_start_infoin that case.Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
Juergen
Re: [PATCH v2 2/3] xen/store: do not store local values in xen_start_info
In reply to Roger Pau MonneQuoted 8 lines · Roger Pau Monne
There's no need to store the xenstore page or event channel in
xen_start_infoif they are locally initialized.This also fixes PVH local xenstore initialization due to the lack of
xen_start_infoin that case.Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 2/3] xen/store: do not store local values in xen_start_info
In reply to Roger Pau MonneQuoted 8 lines · Roger Pau Monne
There's no need to store the xenstore page or event channel in
xen_start_infoif they are locally initialized.This also fixes PVH local xenstore initialization due to the lack of
xen_start_infoin that case.Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
Pushed to xen/tip.git for-linus-4.18
Juergen
Re: [PATCH v2 2/3] xen/store: do not store local values in xen_start_info
In reply to Roger Pau MonneQuoted 8 lines · Roger Pau Monne
There's no need to store the xenstore page or event channel in
xen_start_infoif they are locally initialized.This also fixes PVH local xenstore initialization due to the lack of
xen_start_infoin that case.Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
Pushed to xen/tip.git for-linus-4.18
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 3/3 xen: share start flags between PV and PVH
In reply to Roger Pau MonneUse a global variable to store the start flags for both PV and PVH. This allows the xen_initial_domain macro to work properly on PVH.
Note that ARM is also switched to use the new variable.
---
Cc: Boris Ostrovsky <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
---
Changes since v1:
- Switch ARM to also use the new xen_start_flags.
--- arch/arm/xen/enlighten.c | 7 ++++--- arch/x86/xen/enlighten.c | 7 +++++++ arch/x86/xen/enlighten_pv.c | 1 + arch/x86/xen/enlighten_pvh.c | 1 + include/xen/xen.h | 4 +++- 5 files changed, 16 insertions(+), 4 deletions(-)
arch/arm/xen/enlighten.c +4 -3
@@ -59,6 +59,9 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;static __read_mostly unsigned int xen_events_irq; +uint32_t xen_start_flags; +EXPORT_SYMBOL (xen_start_flags); + int xen_remap_domain_gfn_array(struct vm_area_struct *vma, unsigned long addr, xen_pfn_t *gfn, int nr,
@@ -282,9 +285,7 @@ void __init xen_early_init(void)xen_setup_features ();if (xen_feature (XENFEAT_dom0)) - xen_start_info->flags |=SIF_INITDOMAIN |SIF_PRIVILEGED ; -else - xen_start_info->flags &= ~(SIF_INITDOMAIN |SIF_PRIVILEGED ); + xen_start_flags |=SIF_INITDOMAIN |SIF_PRIVILEGED ;if (!console_set_on_cmdline && !xen_initial_domain ())add_preferred_console ("hvc" ,0 ,NULL );
arch/x86/xen/enlighten.c +7 -0
@@ -64,6 +64,13 @@ struct shared_info xen_dummy_shared_info;__read_mostly int xen_have_vector_callback;EXPORT_SYMBOL_GPL (xen_have_vector_callback); +/* +* NB: needs to live in .data because it's used by xen_prepare_pvh which runs +* before clearing the bss. +*/ +uint32_t xen_start_flags __attribute__((section(".data"))) = 0; +EXPORT_SYMBOL (xen_start_flags); +/* * Point at some empty memory to start with. We map the real shared_info * page as soon as fixmap is up and running.
arch/x86/xen/enlighten_pv.c +1 -0
@@ -1227,6 +1227,7 @@ asmlinkage __visible void __init xen_start_kernel(void)return ; xen_domain_type =XEN_PV_DOMAIN ; + xen_start_flags = xen_start_info->flags;xen_setup_features ();
arch/x86/xen/enlighten_pvh.c +1 -0
@@ -98,6 +98,7 @@ void __init xen_prepare_pvh(void) } xen_pvh =1 ; + xen_start_flags = pvh_start_info.flags;wrmsr_safe (MSR_MTRRdefType,0x800 |MTRR_TYPE_WRBACK ,0 );
include/xen/xen.h +3 -1
@@ -29,8 +29,10 @@ extern bool xen_pvh;#include <xen/interface/xen.h> #include <asm/xen/hypervisor.h> +extern uint32_t xen_start_flags; +#define xen_initial_domain () (xen_domain() && \ - xen_start_info && xen_start_info->flags & SIF_INITDOMAIN) + (xen_start_flags & SIF_INITDOMAIN))#else /* !CONFIG_XEN_DOM0 */ #define xen_initial_domain () (0)#endif /* CONFIG_XEN_DOM0 */
Signature · 7 lines
2.17.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 3/3 xen: share start flags between PV and PVH
In reply to Roger Pau MonneUse a global variable to store the start flags for both PV and PVH. This allows the xen_initial_domain macro to work properly on PVH.
Note that ARM is also switched to use the new variable.
---
Cc: Boris Ostrovsky <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
---
Changes since v1:
- Switch ARM to also use the new xen_start_flags.
--- arch/arm/xen/enlighten.c | 7 ++++--- arch/x86/xen/enlighten.c | 7 +++++++ arch/x86/xen/enlighten_pv.c | 1 + arch/x86/xen/enlighten_pvh.c | 1 + include/xen/xen.h | 4 +++- 5 files changed, 16 insertions(+), 4 deletions(-)
arch/arm/xen/enlighten.c +4 -3
@@ -59,6 +59,9 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;static __read_mostly unsigned int xen_events_irq; +uint32_t xen_start_flags; +EXPORT_SYMBOL (xen_start_flags); + int xen_remap_domain_gfn_array(struct vm_area_struct *vma, unsigned long addr, xen_pfn_t *gfn, int nr,
@@ -282,9 +285,7 @@ void __init xen_early_init(void)xen_setup_features ();if (xen_feature (XENFEAT_dom0)) - xen_start_info->flags |=SIF_INITDOMAIN |SIF_PRIVILEGED ; -else - xen_start_info->flags &= ~(SIF_INITDOMAIN |SIF_PRIVILEGED ); + xen_start_flags |=SIF_INITDOMAIN |SIF_PRIVILEGED ;if (!console_set_on_cmdline && !xen_initial_domain ())add_preferred_console ("hvc" ,0 ,NULL );
arch/x86/xen/enlighten.c +7 -0
@@ -64,6 +64,13 @@ struct shared_info xen_dummy_shared_info;__read_mostly int xen_have_vector_callback;EXPORT_SYMBOL_GPL (xen_have_vector_callback); +/* +* NB: needs to live in .data because it's used by xen_prepare_pvh which runs +* before clearing the bss. +*/ +uint32_t xen_start_flags __attribute__((section(".data"))) = 0; +EXPORT_SYMBOL (xen_start_flags); +/* * Point at some empty memory to start with. We map the real shared_info * page as soon as fixmap is up and running.
arch/x86/xen/enlighten_pv.c +1 -0
@@ -1227,6 +1227,7 @@ asmlinkage __visible void __init xen_start_kernel(void)return ; xen_domain_type =XEN_PV_DOMAIN ; + xen_start_flags = xen_start_info->flags;xen_setup_features ();
arch/x86/xen/enlighten_pvh.c +1 -0
@@ -98,6 +98,7 @@ void __init xen_prepare_pvh(void) } xen_pvh =1 ; + xen_start_flags = pvh_start_info.flags;wrmsr_safe (MSR_MTRRdefType,0x800 |MTRR_TYPE_WRBACK ,0 );
include/xen/xen.h +3 -1
@@ -29,8 +29,10 @@ extern bool xen_pvh;#include <xen/interface/xen.h> #include <asm/xen/hypervisor.h> +extern uint32_t xen_start_flags; +#define xen_initial_domain () (xen_domain() && \ - xen_start_info && xen_start_info->flags & SIF_INITDOMAIN) + (xen_start_flags & SIF_INITDOMAIN))#else /* !CONFIG_XEN_DOM0 */ #define xen_initial_domain () (0)#endif /* CONFIG_XEN_DOM0 */
Signature · 1 line
2.17.0
kbuild test robot
build botRe: [PATCH v2 3/3] xen: share start flags between PV and PVH
Thank you for the patch! Yet something to improve:
Hi Roger,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.17-rc4 next-20180509]
[cannot apply to xen-tip/linux-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Roger-Pau-Monne/xen-pvh-Dom0-support/20180509-222240
config: x86_64-randconfig-x009-201818 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 All errors (new ones prefixed by >>):
arch/x86/xen/enlighten_pvh.c: In function 'xen_prepare_pvh':
>> arch/x86/xen/enlighten_pvh.c:101:2: error: 'xen_start_flags' undeclared (first use in this function); did you mean 'xen_start_info'?
xen_start_flags = pvh_start_info.flags;
^~~~~~~~~~~~~~~
xen_start_info arch/x86/xen/enlighten_pvh.c:101:2: note: each undeclared identifier is reported only once for each function it appears in
vim +101 arch/x86/xen/enlighten_pvh.c
84
85 /*
86 * This routine (and those that it might call) should not use
87 * anything that lives in .bss since that segment will be cleared later.
88 */
89 void __init xen_prepare_pvh(void)
90 {
91 u32 msr;
92 u64 pfn;
93
94 if (pvh_start_info.magic != XEN_HVM_START_MAGIC_VALUE) {
95 xen_raw_printk("Error: Unexpected magic value (0x%08x)\n",
96 pvh_start_info.magic);
97 BUG();
98 }
99
100 xen_pvh = 1;
> 101 xen_start_flags = pvh_start_info.flags;---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH v2 3/3] xen: share start flags between PV and PVH
In reply to Roger Pau MonneThank you for the patch! Yet something to improve:
Hi Roger,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.17-rc4 next-20180509]
[cannot apply to xen-tip/linux-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Roger-Pau-Monne/xen-pvh-Dom0-support/20180509-222240
config: x86_64-randconfig-x009-201818 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 All errors (new ones prefixed by >>):
arch/x86/xen/enlighten_pvh.c: In function 'xen_prepare_pvh':
>> arch/x86/xen/enlighten_pvh.c:101:2: error: 'xen_start_flags' undeclared (first use in this function); did you mean 'xen_start_info'?
xen_start_flags = pvh_start_info.flags;
^~~~~~~~~~~~~~~
xen_start_info arch/x86/xen/enlighten_pvh.c:101:2: note: each undeclared identifier is reported only once for each function it appears in
vim +101 arch/x86/xen/enlighten_pvh.c
84
85 /*
86 * This routine (and those that it might call) should not use
87 * anything that lives in .bss since that segment will be cleared later.
88 */
89 void __init xen_prepare_pvh(void)
90 {
91 u32 msr;
92 u64 pfn;
93
94 if (pvh_start_info.magic != XEN_HVM_START_MAGIC_VALUE) {
95 xen_raw_printk("Error: Unexpected magic value (0x%08x)\n",
96 pvh_start_info.magic);
97 BUG();
98 }
99
100 xen_pvh = 1;
> 101 xen_start_flags = pvh_start_info.flags;---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Stefano Stabellini
maintainerRe: [PATCH v2 3/3] xen: share start flags between PV and PVH
In reply to Roger Pau MonneQuoted 7 lines · Roger Pau Monne
Use a global variable to store the start flags for both PV and PVH. This allows the
xen_initial_domainmacro to work properly on PVH.Note that ARM is also switched to use the new variable.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
Quoted 8 lines
---
Cc: Boris Ostrovsky <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
---
Changes since v1:
- Switch ARM to also use the newxen_start_flags.
The ARM side looks good
Quoted 94 lines
--- arch/arm/xen/enlighten.c | 7 ++++--- arch/x86/xen/enlighten.c | 7 +++++++ arch/x86/xen/enlighten_pv.c | 1 + arch/x86/xen/enlighten_pvh.c | 1 + include/xen/xen.h | 4 +++- 5 files changed, 16 insertions(+), 4 deletions(-)arch/arm/xen/enlighten.c +4
-3@@ -59,6 +59,9 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;static __read_mostly unsigned int xen_events_irq; +uint32_t xen_start_flags; +EXPORT_SYMBOL (xen_start_flags); + int xen_remap_domain_gfn_array(struct vm_area_struct *vma, unsigned long addr, xen_pfn_t *gfn, int nr,@@ -282,9 +285,7 @@ void __init xen_early_init(void)xen_setup_features ();if (xen_feature (XENFEAT_dom0)) - xen_start_info->flags |=SIF_INITDOMAIN |SIF_PRIVILEGED ; -else - xen_start_info->flags &= ~(SIF_INITDOMAIN |SIF_PRIVILEGED ); + xen_start_flags |=SIF_INITDOMAIN |SIF_PRIVILEGED ;if (!console_set_on_cmdline && !xen_initial_domain ())add_preferred_console ("hvc" ,0 ,NULL );arch/x86/xen/enlighten.c +7
-0@@ -64,6 +64,13 @@ struct shared_info xen_dummy_shared_info;__read_mostly int xen_have_vector_callback;EXPORT_SYMBOL_GPL (xen_have_vector_callback); +/* +* NB: needs to live in .data because it's used by xen_prepare_pvh which runs +* before clearing the bss. +*/ +uint32_t xen_start_flags __attribute__((section(".data"))) = 0; +EXPORT_SYMBOL (xen_start_flags); +/* * Point at some empty memory to start with. We map the real shared_info * page as soon as fixmap is up and running. arch/x86/xen/enlighten_pv.c +1
-0@@ -1227,6 +1227,7 @@ asmlinkage __visible void __init xen_start_kernel(void)return ; xen_domain_type =XEN_PV_DOMAIN ; + xen_start_flags = xen_start_info->flags;xen_setup_features ();arch/x86/xen/enlighten_pvh.c +1
-0@@ -98,6 +98,7 @@ void __init xen_prepare_pvh(void) } xen_pvh =1 ; + xen_start_flags = pvh_start_info.flags;wrmsr_safe (MSR_MTRRdefType,0x800 |MTRR_TYPE_WRBACK ,0 );include/xen/xen.h +3
-1@@ -29,8 +29,10 @@ extern bool xen_pvh;#include <xen/interface/xen.h> #include <asm/xen/hypervisor.h> +extern uint32_t xen_start_flags; +#define xen_initial_domain () (xen_domain() && \ - xen_start_info && xen_start_info->flags & SIF_INITDOMAIN) + (xen_start_flags & SIF_INITDOMAIN))#else /* !CONFIG_XEN_DOM0 */ #define xen_initial_domain () (0)#endif /* CONFIG_XEN_DOM0 */ Signature · 1 line
2.17.0
Stefano Stabellini
maintainerRe: [PATCH v2 3/3] xen: share start flags between PV and PVH
In reply to Roger Pau MonneQuoted 7 lines · Roger Pau Monne
Use a global variable to store the start flags for both PV and PVH. This allows the
xen_initial_domainmacro to work properly on PVH.Note that ARM is also switched to use the new variable.
Signed-off-by Boris Ostrovsky <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
Quoted 8 lines
---
Cc: Boris Ostrovsky <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
---
Changes since v1:
- Switch ARM to also use the newxen_start_flags.
The ARM side looks good
Quoted 94 lines
--- arch/arm/xen/enlighten.c | 7 ++++--- arch/x86/xen/enlighten.c | 7 +++++++ arch/x86/xen/enlighten_pv.c | 1 + arch/x86/xen/enlighten_pvh.c | 1 + include/xen/xen.h | 4 +++- 5 files changed, 16 insertions(+), 4 deletions(-)arch/arm/xen/enlighten.c +4
-3@@ -59,6 +59,9 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;static __read_mostly unsigned int xen_events_irq; +uint32_t xen_start_flags; +EXPORT_SYMBOL (xen_start_flags); + int xen_remap_domain_gfn_array(struct vm_area_struct *vma, unsigned long addr, xen_pfn_t *gfn, int nr,@@ -282,9 +285,7 @@ void __init xen_early_init(void)xen_setup_features ();if (xen_feature (XENFEAT_dom0)) - xen_start_info->flags |=SIF_INITDOMAIN |SIF_PRIVILEGED ; -else - xen_start_info->flags &= ~(SIF_INITDOMAIN |SIF_PRIVILEGED ); + xen_start_flags |=SIF_INITDOMAIN |SIF_PRIVILEGED ;if (!console_set_on_cmdline && !xen_initial_domain ())add_preferred_console ("hvc" ,0 ,NULL );arch/x86/xen/enlighten.c +7
-0@@ -64,6 +64,13 @@ struct shared_info xen_dummy_shared_info;__read_mostly int xen_have_vector_callback;EXPORT_SYMBOL_GPL (xen_have_vector_callback); +/* +* NB: needs to live in .data because it's used by xen_prepare_pvh which runs +* before clearing the bss. +*/ +uint32_t xen_start_flags __attribute__((section(".data"))) = 0; +EXPORT_SYMBOL (xen_start_flags); +/* * Point at some empty memory to start with. We map the real shared_info * page as soon as fixmap is up and running. arch/x86/xen/enlighten_pv.c +1
-0@@ -1227,6 +1227,7 @@ asmlinkage __visible void __init xen_start_kernel(void)return ; xen_domain_type =XEN_PV_DOMAIN ; + xen_start_flags = xen_start_info->flags;xen_setup_features ();arch/x86/xen/enlighten_pvh.c +1
-0@@ -98,6 +98,7 @@ void __init xen_prepare_pvh(void) } xen_pvh =1 ; + xen_start_flags = pvh_start_info.flags;wrmsr_safe (MSR_MTRRdefType,0x800 |MTRR_TYPE_WRBACK ,0 );include/xen/xen.h +3
-1@@ -29,8 +29,10 @@ extern bool xen_pvh;#include <xen/interface/xen.h> #include <asm/xen/hypervisor.h> +extern uint32_t xen_start_flags; +#define xen_initial_domain () (xen_domain() && \ - xen_start_info && xen_start_info->flags & SIF_INITDOMAIN) + (xen_start_flags & SIF_INITDOMAIN))#else /* !CONFIG_XEN_DOM0 */ #define xen_initial_domain () (0)#endif /* CONFIG_XEN_DOM0 */ Signature · 1 line
2.17.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel