xen: add pvh guest support
Juergen Gross
maintainerv2 cover xen: add pvh guest support
This patch series adds support for booting Linux as PVH guest.
Similar to i386/xen and x86_64/xen platforms the new i386/xenpvh platform grub is booted as a standalone image directly by Xen.
For booting Linux kernel it is using the standard linux kernel loader. The only modification of the linux loader is to pass the ACPI RSDP address via boot parameters to the kernel, as that table might not be located at the usual physical address just below 1MB.
As the related Linux kernel patches are not yet accepted please wait for this to happen before applying the series. This Linux kernel series is available under:
https://lists.xen.org/archives/html/xen-devel/2018-10/msg00776.html
Changes in V2:
- extend linux boot protocol version 2.14 to report back the protocol version supported by grub2 (needed as there are grub2 downstream variants in some distros which clobber data after the setup_header)
- split former patch 4 into 10 patches
- fix memmap handling for >4GB of memory
- added new patch from Hans (thanks for that one)
- addressed most of Daniel's comments (see individual patches)
Hans van Kranenburg (1):
grub-module-verifier: Ignore all_video for xenpvh
Juergen Gross (17):
xen: add some xen headers
loader/linux: support passing rsdp address via boot params
xen: carve out grant tab initialization into dedicated function
xen: prepare common code for Xen PVH support
xen: add some dummy headers for PVH mode
xen: rearrange xen/init.c to prepare it for Xen PVH mode
xen: add PVH specific defines to offset.h
xen: add basic hooks for PVH in current code
xen: add PVH boot entry code
xen: setup hypercall page for PVH
xen: get memory map from hypervisor for PVH
xen: setup Xen specific data for PVH
xen: init memory regions for PVH
xenpvh: add build runes for grub-core
xenpvh: support building a standalone image
xenpvh: support grub-install for xenpvh
xenpvh: add support to configure
configure.ac | 3 + gentpl.py | 4 +- grub-core/Makefile.am | 12 + grub-core/Makefile.core.def | 35 ++ grub-core/kern/i386/tsc.c | 2 +- grub-core/kern/i386/xen/pvh.c | 346 ++++++++++++++++++ grub-core/kern/i386/xen/startup_pvh.S | 79 ++++ grub-core/kern/xen/init.c | 101 ++++-- grub-core/loader/i386/linux.c | 9 + include/grub/i386/linux.h | 5 +- include/grub/i386/pc/int.h | 3 + include/grub/i386/tsc.h | 2 +- include/grub/i386/xen/hypercall.h | 5 +- include/grub/i386/xenpvh/boot.h | 1 + include/grub/i386/xenpvh/console.h | 1 + include/grub/i386/xenpvh/int.h | 1 + include/grub/i386/xenpvh/kernel.h | 30 ++ include/grub/i386/xenpvh/memory.h | 1 + include/grub/i386/xenpvh/time.h | 1 + include/grub/kernel.h | 4 +- include/grub/offsets.h | 21 +- include/grub/util/install.h | 1 + include/grub/util/mkimage.h | 3 +- include/grub/xen.h | 6 + include/xen/hvm/hvm_op.h | 296 +++++++++++++++ include/xen/hvm/params.h | 284 +++++++++++++++ include/xen/hvm/start_info.h | 98 +++++ include/xen/memory.h | 665 ++++++++++++++++++++++++++++++++++ include/xen/physdev.h | 387 ++++++++++++++++++++ include/xen/trace.h | 339 +++++++++++++++++ include/xen/xen.h | 104 ++++-- util/grub-install-common.c | 1 + util/grub-install.c | 7 + util/grub-mkimage32.c | 4 +- util/grub-mkimage64.c | 4 +- util/grub-mkimagexx.c | 58 ++- util/grub-module-verifier.c | 1 + util/mkimage.c | 23 +- 38 files changed, 2846 insertions(+), 101 deletions(-) create mode 100644 grub-core/kern/i386/xen/pvh.c create mode 100644 grub-core/kern/i386/xen/startup_pvh.S create mode 100644 include/grub/i386/xenpvh/boot.h create mode 100644 include/grub/i386/xenpvh/console.h create mode 100644 include/grub/i386/xenpvh/int.h create mode 100644 include/grub/i386/xenpvh/kernel.h create mode 100644 include/grub/i386/xenpvh/memory.h create mode 100644 include/grub/i386/xenpvh/time.h create mode 100644 include/xen/hvm/hvm_op.h create mode 100644 include/xen/hvm/params.h create mode 100644 include/xen/hvm/start_info.h create mode 100644 include/xen/memory.h create mode 100644 include/xen/physdev.h create mode 100644 include/xen/trace.h
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v2 1/18 xen: add some xen headers
In order to support grub2 in Xen PVH environment some additional Xen headers are needed as grub2 will be started in PVH mode requiring to use several HVM hypercalls and structures.
Add the needed headers from Xen 4.10 being the first Xen version with full (not only experimental) PVH guest support.
---
V2: update commit message (Daniel Kiper)
--- include/xen/hvm/hvm_op.h | 296 +++++++++++++++++++ include/xen/hvm/params.h | 284 ++++++++++++++++++ include/xen/hvm/start_info.h | 98 +++++++ include/xen/memory.h | 665 +++++++++++++++++++++++++++++++++++++++++++ include/xen/physdev.h | 387 +++++++++++++++++++++++++ include/xen/trace.h | 339 ++++++++++++++++++++++ include/xen/xen.h | 104 +++++-- 7 files changed, 2142 insertions(+), 31 deletions(-) create mode 100644 include/xen/hvm/hvm_op.h create mode 100644 include/xen/hvm/params.h create mode 100644 include/xen/hvm/start_info.h create mode 100644 include/xen/memory.h create mode 100644 include/xen/physdev.h create mode 100644 include/xen/trace.h
include/xen/hvm/hvm_op.h new file +296 -0
@@ -0,0 +1,296 @@ +/* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to +* deal in the Software without restriction, including without limitation the +* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +* sell copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +* +* Copyright (c) 2007, Keir Fraser +*/ + +#ifndef __XEN_PUBLIC_HVM_HVM_OP_H__ +#define __XEN_PUBLIC_HVM_HVM_OP_H__ + +#include "../xen.h" +#include "../trace.h" +#include "../event_channel.h" + +/* Get/set subcommands: extra argument == pointer to xen_hvm_param struct. */ +#define HVMOP_set_param 0 +#define HVMOP_get_param 1 +struct xen_hvm_param { +domid_t domid;/* IN */ +uint32_t index;/* IN */ +uint64_t value;/* IN/OUT */ +}; +typedef struct xen_hvm_param xen_hvm_param_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_param_t); + +#if __XEN_INTERFACE_VERSION__ <0x00040900 + +/* Set the logical level of one of a domain's PCI INTx wires. */ +#define HVMOP_set_pci_intx_level 2 +struct xen_hvm_set_pci_intx_level { +/* Domain to be updated. */ +domid_t domid; +/* PCI INTx identification in PCI topology (domain:bus:device:intx). */ +uint8_t domain, bus, device, intx; +/* Assertion level (0 = unasserted, 1 = asserted). */ +uint8_t level; +}; +typedef struct xen_hvm_set_pci_intx_level xen_hvm_set_pci_intx_level_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_set_pci_intx_level_t); + +/* Set the logical level of one of a domain's ISA IRQ wires. */ +#define HVMOP_set_isa_irq_level 3 +struct xen_hvm_set_isa_irq_level { +/* Domain to be updated. */ +domid_t domid; +/* ISA device identification, by ISA IRQ (0-15). */ +uint8_t isa_irq; +/* Assertion level (0 = unasserted, 1 = asserted). */ +uint8_t level; +}; +typedef struct xen_hvm_set_isa_irq_level xen_hvm_set_isa_irq_level_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_set_isa_irq_level_t); + +#define HVMOP_set_pci_link_route 4 +struct xen_hvm_set_pci_link_route { +/* Domain to be updated. */ +domid_t domid; +/* PCI link identifier (0-3). */ +uint8_t link; +/* ISA IRQ (1-15), or 0 (disable link). */ +uint8_t isa_irq; +}; +typedef struct xen_hvm_set_pci_link_route xen_hvm_set_pci_link_route_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_set_pci_link_route_t); + +#endif /* __XEN_INTERFACE_VERSION__ < 0x00040900 */ + +/* Flushes all VCPU TLBs: @arg must be NULL. */ +#define HVMOP_flush_tlbs 5 + +typedef enum { + HVMMEM_ram_rw,/* Normal read/write guest RAM */ + HVMMEM_ram_ro,/* Read-only; writes are discarded */ + HVMMEM_mmio_dm,/* Reads and write go to the device model */ +#if __XEN_INTERFACE_VERSION__ <0x00040700 + HVMMEM_mmio_write_dm,/* Read-only; writes go to the device model */ +#else + HVMMEM_unused,/* Placeholder; setting memory to this type +will fail for code after 4.7.0 */ +#endif + HVMMEM_ioreq_server/* Memory type claimed by an ioreq server; type +changes to this value are only allowed after +an ioreq server has claimed its ownership. +Only pages with HVMMEM_ram_rw are allowed to +change to this type; conversely, pages with +this type are only allowed to be changed back +to HVMMEM_ram_rw. */ +}hvmmem_type_t ; + +/* Hint from PV drivers for pagetable destruction. */ +#define HVMOP_pagetable_dying 9 +struct xen_hvm_pagetable_dying { +/* Domain with a pagetable about to be destroyed. */ +domid_t domid; +uint16_t pad[3 ];/* align next field on 8-byte boundary */ +/* guest physical address of the toplevel pagetable dying */ +uint64_t gpa; +}; +typedef struct xen_hvm_pagetable_dying xen_hvm_pagetable_dying_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_pagetable_dying_t); + +/* Get the current Xen time, in nanoseconds since system boot. */ +#define HVMOP_get_time 10 +struct xen_hvm_get_time { +uint64_t now;/* OUT */ +}; +typedef struct xen_hvm_get_time xen_hvm_get_time_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_get_time_t); + +#define HVMOP_xentrace 11 +struct xen_hvm_xentrace { +uint16_t event, extra_bytes; +uint8_t extra[TRACE_EXTRA_MAX *sizeof (uint32_t )]; +}; +typedef struct xen_hvm_xentrace xen_hvm_xentrace_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_xentrace_t); + +/* Following tools-only interfaces may change in future. */ +#if defined(__XEN__) || defined(__XEN_TOOLS__) + +/* Deprecated by XENMEM_access_op_set_access */ +#define HVMOP_set_mem_access 12 + +/* Deprecated by XENMEM_access_op_get_access */ +#define HVMOP_get_mem_access 13 + +#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */ + +#define HVMOP_get_mem_type 15 +/* Return hvmmem_type_t for the specified pfn. */ +struct xen_hvm_get_mem_type { +/* Domain to be queried. */ +domid_t domid; +/* OUT variable. */ +uint16_t mem_type; +uint16_t pad[2 ];/* align next field on 8-byte boundary */ +/* IN variable. */ +uint64_t pfn; +}; +typedef struct xen_hvm_get_mem_type xen_hvm_get_mem_type_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_get_mem_type_t); + +/* Following tools-only interfaces may change in future. */ +#if defined(__XEN__) || defined(__XEN_TOOLS__) + +/* +* Definitions relating to DMOP_create_ioreq_server. (Defined here for +* backwards compatibility). +*/ + +#define HVM_IOREQSRV_BUFIOREQ_OFF 0 +#define HVM_IOREQSRV_BUFIOREQ_LEGACY 1 +/* +* Use this when read_pointer gets updated atomically and +* the pointer pair gets read atomically: +*/ +#define HVM_IOREQSRV_BUFIOREQ_ATOMIC 2 + +#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */ + +#if defined(__i386__) || defined(__x86_64__) + +/* +* HVMOP_set_evtchn_upcall_vector: Set a <vector> that should be used for event +* channel upcalls on the specified <vcpu>. If set, +* this vector will be used in preference to the +* domain global callback via (see +* HVM_PARAM_CALLBACK_IRQ). +*/ +#define HVMOP_set_evtchn_upcall_vector 23 +struct xen_hvm_evtchn_upcall_vector { +uint32_t vcpu; +uint8_t vector; +}; +typedef struct xen_hvm_evtchn_upcall_vector xen_hvm_evtchn_upcall_vector_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_evtchn_upcall_vector_t); + +#endif /* defined(__i386__) || defined(__x86_64__) */ + +#define HVMOP_guest_request_vm_event 24 + +/* HVMOP_altp2m: perform altp2m state operations */ +#define HVMOP_altp2m 25 + +#define HVMOP_ALTP2M_INTERFACE_VERSION 0x00000001 + +struct xen_hvm_altp2m_domain_state { +/* IN or OUT variable on/off */ +uint8_t state; +}; +typedef struct xen_hvm_altp2m_domain_state xen_hvm_altp2m_domain_state_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_altp2m_domain_state_t); + +struct xen_hvm_altp2m_vcpu_enable_notify { +uint32_t vcpu_id; +uint32_t pad; +/* #VE info area gfn */ +uint64_t gfn; +}; +typedef struct xen_hvm_altp2m_vcpu_enable_notify xen_hvm_altp2m_vcpu_enable_notify_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_altp2m_vcpu_enable_notify_t); + +struct xen_hvm_altp2m_view { +/* IN/OUT variable */ +uint16_t view; +/* Create view only: default access type +* NOTE: currently ignored */ +uint16_t hvmmem_default_access;/* xenmem_access_t */ +}; +typedef struct xen_hvm_altp2m_view xen_hvm_altp2m_view_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_altp2m_view_t); + +struct xen_hvm_altp2m_set_mem_access { +/* view */ +uint16_t view; +/* Memory type */ +uint16_t hvmmem_access;/* xenmem_access_t */ +uint32_t pad; +/* gfn */ +uint64_t gfn; +}; +typedef struct xen_hvm_altp2m_set_mem_access xen_hvm_altp2m_set_mem_access_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_altp2m_set_mem_access_t); + +struct xen_hvm_altp2m_change_gfn { +/* view */ +uint16_t view; +uint16_t pad1; +uint32_t pad2; +/* old gfn */ +uint64_t old_gfn; +/* new gfn, INVALID_GFN (~0UL) means revert */ +uint64_t new_gfn; +}; +typedef struct xen_hvm_altp2m_change_gfn xen_hvm_altp2m_change_gfn_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_altp2m_change_gfn_t); + +struct xen_hvm_altp2m_op { +uint32_t version;/* HVMOP_ALTP2M_INTERFACE_VERSION */ +uint32_t cmd; +/* Get/set the altp2m state for a domain */ +#define HVMOP_altp2m_get_domain_state 1 +#define HVMOP_altp2m_set_domain_state 2 +/* Set the current VCPU to receive altp2m event notifications */ +#define HVMOP_altp2m_vcpu_enable_notify 3 +/* Create a new view */ +#define HVMOP_altp2m_create_p2m 4 +/* Destroy a view */ +#define HVMOP_altp2m_destroy_p2m 5 +/* Switch view for an entire domain */ +#define HVMOP_altp2m_switch_p2m 6 +/* Notify that a page of memory is to have specific access types */ +#define HVMOP_altp2m_set_mem_access 7 +/* Change a p2m entry to have a different gfn->mfn mapping */ +#define HVMOP_altp2m_change_gfn 8 +domid_t domain; +uint16_t pad1; +uint32_t pad2; +union { +struct xen_hvm_altp2m_domain_state domain_state; +struct xen_hvm_altp2m_vcpu_enable_notify enable_notify; +struct xen_hvm_altp2m_view view; +struct xen_hvm_altp2m_set_mem_access set_mem_access; +struct xen_hvm_altp2m_change_gfn change_gfn; +uint8_t pad[64 ]; + } u; +}; +typedef struct xen_hvm_altp2m_op xen_hvm_altp2m_op_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_altp2m_op_t); + +#endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* tab-width: 4 +* indent-tabs-mode: nil +* End: +*/
include/xen/hvm/params.h new file +284 -0
284 lines not on this page · raw message
include/xen/hvm/start_info.h new file +98 -0
98 lines not on this page · raw message
include/xen/memory.h new file +665 -0
665 lines not on this page · raw message
include/xen/physdev.h new file +387 -0
387 lines not on this page · raw message
include/xen/trace.h new file +339 -0
339 lines not on this page · raw message
include/xen/xen.h +73 -31
170 lines not on this page · raw message
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 01/18] xen: add some xen headers
Quoted 6 lines · Juergen Gross
In order to support grub2 in Xen PVH environment some additional Xen headers are needed as grub2 will be started in PVH mode requiring to use several HVM hypercalls and structures.
Add the needed headers from Xen 4.10 being the first Xen version with full (not only experimental) PVH guest support.
Should not we use the latest one? 4.11?
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 01/18] xen: add some xen headers
In reply to Juergen GrossQuoted 6 lines · Juergen Gross
In order to support grub2 in Xen PVH environment some additional Xen headers are needed as grub2 will be started in PVH mode requiring to use several HVM hypercalls and structures.
Add the needed headers from Xen 4.10 being the first Xen version with full (not only experimental) PVH guest support.
Should not we use the latest one? 4.11?
Daniel
Juergen Gross
maintainerRe: [PATCH v2 01/18] xen: add some xen headers
Quoted 9 lines · Daniel Kiper
Quoted 6 lines · Juergen Gross
In order to support grub2 in Xen PVH environment some additional Xen headers are needed as grub2 will be started in PVH mode requiring to use several HVM hypercalls and structures.
Add the needed headers from Xen 4.10 being the first Xen version with full (not only experimental) PVH guest support.
Should not we use the latest one? 4.11?
Hmm, that shouldn't really matter here. All used interfaces are stable, so in case we don't need any later add-ons (which we don't) using the 4.10 ones must be fine.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [PATCH v2 01/18] xen: add some xen headers
In reply to Daniel KiperQuoted 9 lines · Daniel Kiper
Quoted 6 lines · Juergen Gross
In order to support grub2 in Xen PVH environment some additional Xen headers are needed as grub2 will be started in PVH mode requiring to use several HVM hypercalls and structures.
Add the needed headers from Xen 4.10 being the first Xen version with full (not only experimental) PVH guest support.
Should not we use the latest one? 4.11?
Hmm, that shouldn't really matter here. All used interfaces are stable, so in case we don't need any later add-ons (which we don't) using the 4.10 ones must be fine.
Juergen
Re: [PATCH v2 01/18] xen: add some xen headers
Quoted 6 lines · Juergen Gross
Quoted 5 lines · Daniel Kiper
Quoted 4 lines · Juergen Gross
In order to support grub2 in Xen PVH environment some additional Xen headers are needed as grub2 will be started in PVH mode requiring to use several HVM hypercalls and structures.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Add the needed headers from Xen 4.10 being the first Xen version with full (not only experimental) PVH guest support.
Should not we use the latest one? 4.11?
Hmm, that shouldn't really matter here. All used interfaces are stable, so in case we don't need any later add-ons (which we don't) using the 4.10 ones must be fine.
OK, Reviewed-by: Daniel Kiper <[email protected]>
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 01/18] xen: add some xen headers
In reply to Juergen GrossQuoted 6 lines · Juergen Gross
Quoted 5 lines · Daniel Kiper
Quoted 4 lines · Juergen Gross
In order to support grub2 in Xen PVH environment some additional Xen headers are needed as grub2 will be started in PVH mode requiring to use several HVM hypercalls and structures.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Add the needed headers from Xen 4.10 being the first Xen version with full (not only experimental) PVH guest support.
Should not we use the latest one? 4.11?
Hmm, that shouldn't really matter here. All used interfaces are stable, so in case we don't need any later add-ons (which we don't) using the 4.10 ones must be fine.
OK, Reviewed-by: Daniel Kiper <[email protected]>
Daniel
Juergen Gross
maintainerPATCH v2 2/18 loader/linux: support passing rsdp address via boot params
In reply to Juergen GrossXen PVH guests will have the RSDP at an arbitrary address. Support that by passing the RSDP address via the boot parameters to Linux.
The new protocol version 2.14 requires to set version to 0x8000 ored with the actually use protocol version (the minimum of the kernel supplied protocol version and the grub2 supported protocol version) if 2.14 or higher are in effect.
---
V2: add oring 0x8000 to version field
--- grub-core/loader/i386/linux.c | 9 +++++++++ include/grub/i386/linux.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-)
grub-core/loader/i386/linux.c +9 -0
@@ -35,6 +35,7 @@#include <grub/i18n.h> #include <grub/lib/cmdline.h> #include <grub/linux.h> +#include <grub/machine/kernel.h> GRUB_MOD_LICENSE ("GPLv3+" );
@@ -750,6 +751,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), prot_init_space =page_align (prot_size) *3 ; } +#ifdef GRUB_KERNEL_USE_RSDP_ADDR +if (grub_le_to_cpu16 (lh.version) >=0x020e ) + lh.acpi_rsdp_addr =grub_le_to_cpu64 (grub_rsdp_addr); +#endif + +if (grub_le_to_cpu16 (lh.version) >=0x020e ) + lh.version =grub_le_to_cpu16 (LINUX_LOADER_VERSION_TAG |0x020e ); +if (allocate_pages (prot_size, &align, min_align, relocatable, preferred_address))
include/grub/i386/linux.h +4 -1
@@ -87,7 +87,7 @@ enumGRUB_VIDEO_LINUX_TYPE_SIMPLE =0x70 /* Linear framebuffer without any additional functions. */ }; -/* For the Linux/i386 boot protocol version 2.10. */ +/* For the Linux/i386 boot protocol version 2.14. */ struct linux_i386_kernel_header {grub_uint8_t code1[0x0020 ];
@@ -105,6 +105,7 @@ struct linux_i386_kernel_headergrub_uint16_t jump;/* Jump instruction */ grub_uint32_t header;/* Magic signature "HdrS" */ grub_uint16_t version;/* Boot protocol version supported */ +#define LINUX_LOADER_VERSION_TAG 0x8000grub_uint32_t realmode_swtch;/* Boot loader hook */ grub_uint16_t start_sys;/* The load-low segment (obsolete) */ grub_uint16_t kernel_version;/* Points to kernel version string */
@@ -142,6 +143,8 @@ struct linux_i386_kernel_headergrub_uint64_t setup_data;grub_uint64_t pref_address;grub_uint32_t init_size; +grub_uint32_t handover_offset; +grub_uint64_t acpi_rsdp_addr; }GRUB_PACKED ;/* Boot parameters for Linux based on 2.6.12. This is used by the setup
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 02/18] loader/linux: support passing rsdp address via boot params
Quoted 21 lines · Juergen Gross
Xen PVH guests will have the RSDP at an arbitrary address. Support that by passing the RSDP address via the boot parameters to Linux.
The new protocol version 2.14 requires to set version to
0x8000ored with the actually use protocol version (the minimum of the kernel supplied protocol version and the grub2 supported protocol version) if 2.14 or higher are in effect.Signed-off-by Juergen Gross <[email protected]>---
V2: add oring0x8000to version field--- grub-core/loader/i386/linux.c | 9 +++++++++ include/grub/i386/linux.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-)grub-core/loader/i386/linux.c +0
-0
grub-core/loader/i386/linux.c line 38
Quoted 4 lines
grub-core/loader/i386/linux.c +1
-0@@ -35,6 +35,7 @@#include <grub/i18n.h> #include <grub/lib/cmdline.h> #include <grub/linux.h> +#include <grub/machine/kernel.h>
Probably this change belongs to another patch.
grub-core/loader/i386/linux.c grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), · line 757
Quoted 10 lines
grub-core/loader/i386/linux.c +4
-0GRUB_MOD_LICENSE ("GPLv3+" );@@ -750,6 +751,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), prot_init_space =page_align (prot_size) *3 ; } +#ifdef GRUB_KERNEL_USE_RSDP_ADDR +if (grub_le_to_cpu16 (lh.version) >=0x020e ) + lh.acpi_rsdp_addr =grub_le_to_cpu64 (grub_rsdp_addr); +#endif
It seems to me that this belongs to patch #8. Does not it?
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 02/18] loader/linux: support passing rsdp address via boot params
In reply to Juergen GrossQuoted 21 lines · Juergen Gross
Xen PVH guests will have the RSDP at an arbitrary address. Support that by passing the RSDP address via the boot parameters to Linux.
The new protocol version 2.14 requires to set version to
0x8000ored with the actually use protocol version (the minimum of the kernel supplied protocol version and the grub2 supported protocol version) if 2.14 or higher are in effect.Signed-off-by Juergen Gross <[email protected]>---
V2: add oring0x8000to version field--- grub-core/loader/i386/linux.c | 9 +++++++++ include/grub/i386/linux.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-)grub-core/loader/i386/linux.c +0
-0
grub-core/loader/i386/linux.c line 38
Quoted 4 lines
grub-core/loader/i386/linux.c +1
-0@@ -35,6 +35,7 @@#include <grub/i18n.h> #include <grub/lib/cmdline.h> #include <grub/linux.h> +#include <grub/machine/kernel.h>
Probably this change belongs to another patch.
grub-core/loader/i386/linux.c grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), · line 757
Quoted 10 lines
grub-core/loader/i386/linux.c +4
-0GRUB_MOD_LICENSE ("GPLv3+" );@@ -750,6 +751,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), prot_init_space =page_align (prot_size) *3 ; } +#ifdef GRUB_KERNEL_USE_RSDP_ADDR +if (grub_le_to_cpu16 (lh.version) >=0x020e ) + lh.acpi_rsdp_addr =grub_le_to_cpu64 (grub_rsdp_addr); +#endif
It seems to me that this belongs to patch #8. Does not it?
Daniel
Juergen Gross
maintainerRe: [PATCH v2 02/18] loader/linux: support passing rsdp address via boot params
Quoted 17 lines · Daniel Kiper
Quoted 16 lines · Juergen Gross
Xen PVH guests will have the RSDP at an arbitrary address. Support that by passing the RSDP address via the boot parameters to Linux.
The new protocol version 2.14 requires to set version to
0x8000ored with the actually use protocol version (the minimum of the kernel supplied protocol version and the grub2 supported protocol version) if 2.14 or higher are in effect.Signed-off-by Juergen Gross <[email protected]>---
V2: add oring0x8000to version field--- grub-core/loader/i386/linux.c | 9 +++++++++ include/grub/i386/linux.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-)
Quoted 11 lines
grub-core/loader/i386/linux.c line 38
Quoted 9 lines
grub-core/loader/i386/linux.c +1
-0@@ -35,6 +35,7 @@#include <grub/i18n.h> #include <grub/lib/cmdline.h> #include <grub/linux.h> +#include <grub/machine/kernel.h> Probably this change belongs to another patch.
I don't think so.
Quoted 7 lines
Quoted 7 lines
grub-core/loader/i386/linux.c +0
-0GRUB_MOD_LICENSE ("GPLv3+" );@@ -750,6 +751,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), prot_init_space =page_align (prot_size) *3 ; }
Quoted 6 lines
grub-core/loader/i386/linux.c grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), · line 757
Quoted 4 lines
grub-core/loader/i386/linux.c +4
-0+#ifdef GRUB_KERNEL_USE_RSDP_ADDR +if (grub_le_to_cpu16 (lh.version) >=0x020e ) + lh.acpi_rsdp_addr =grub_le_to_cpu64 (grub_rsdp_addr); +#endif It seems to me that this belongs to patch #8. Does not it?
No, it is a generic new interface.
It will be used by PVH first, but can be used in other environments, too.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [PATCH v2 02/18] loader/linux: support passing rsdp address via boot params
In reply to Daniel KiperQuoted 17 lines · Daniel Kiper
Quoted 16 lines · Juergen Gross
Xen PVH guests will have the RSDP at an arbitrary address. Support that by passing the RSDP address via the boot parameters to Linux.
The new protocol version 2.14 requires to set version to
0x8000ored with the actually use protocol version (the minimum of the kernel supplied protocol version and the grub2 supported protocol version) if 2.14 or higher are in effect.Signed-off-by Juergen Gross <[email protected]>---
V2: add oring0x8000to version field--- grub-core/loader/i386/linux.c | 9 +++++++++ include/grub/i386/linux.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-)
Quoted 11 lines
grub-core/loader/i386/linux.c line 38
Quoted 9 lines
grub-core/loader/i386/linux.c +1
-0@@ -35,6 +35,7 @@#include <grub/i18n.h> #include <grub/lib/cmdline.h> #include <grub/linux.h> +#include <grub/machine/kernel.h> Probably this change belongs to another patch.
I don't think so.
Quoted 7 lines
Quoted 7 lines
grub-core/loader/i386/linux.c +0
-0GRUB_MOD_LICENSE ("GPLv3+" );@@ -750,6 +751,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), prot_init_space =page_align (prot_size) *3 ; }
Quoted 6 lines
grub-core/loader/i386/linux.c grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), · line 757
Quoted 4 lines
grub-core/loader/i386/linux.c +4
-0+#ifdef GRUB_KERNEL_USE_RSDP_ADDR +if (grub_le_to_cpu16 (lh.version) >=0x020e ) + lh.acpi_rsdp_addr =grub_le_to_cpu64 (grub_rsdp_addr); +#endif It seems to me that this belongs to patch #8. Does not it?
No, it is a generic new interface.
It will be used by PVH first, but can be used in other environments, too.
Juergen
Re: [PATCH v2 02/18] loader/linux: support passing rsdp address via boot params
Quoted 30 lines · Juergen Gross
Quoted 17 lines · Daniel Kiper
Quoted 16 lines · Juergen Gross
Xen PVH guests will have the RSDP at an arbitrary address. Support that by passing the RSDP address via the boot parameters to Linux.
The new protocol version 2.14 requires to set version to
0x8000ored with the actually use protocol version (the minimum of the kernel supplied protocol version and the grub2 supported protocol version) if 2.14 or higher are in effect.Signed-off-by Juergen Gross <[email protected]>---
V2: add oring0x8000to version field--- grub-core/loader/i386/linux.c | 9 +++++++++ include/grub/i386/linux.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-)Quoted 11 lines
grub-core/loader/i386/linux.c line 38
Quoted 9 lines
grub-core/loader/i386/linux.c +1
-0@@ -35,6 +35,7 @@#include <grub/i18n.h> #include <grub/lib/cmdline.h> #include <grub/linux.h> +#include <grub/machine/kernel.h> Probably this change belongs to another patch.
Quoted 1 line
I don't think so.
You do not add anything to this header here and out of the blue you include it in this file. So, why it is needed here?
Quoted 13 lines
Quoted 6 lines
Quoted 6 lines
grub-core/loader/i386/linux.c +0
-0GRUB_MOD_LICENSE ("GPLv3+" );@@ -750,6 +751,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), prot_init_space =page_align (prot_size) *3 ; }Quoted 6 lines
grub-core/loader/i386/linux.c grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), · line 757
Quoted 4 lines
grub-core/loader/i386/linux.c +4
-0+#ifdef GRUB_KERNEL_USE_RSDP_ADDR +if (grub_le_to_cpu16 (lh.version) >=0x020e ) + lh.acpi_rsdp_addr =grub_le_to_cpu64 (grub_rsdp_addr); +#endif It seems to me that this belongs to patch #8. Does not it?
Quoted 4 lines
No, it is a generic new interface.
It will be used by PVH first, but can be used in other environments, too.
I do not like this much but if you want me to get it you have to put a blurb in the commit message why this is not enabled here. And when it will be enabled...
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 02/18] loader/linux: support passing rsdp address via boot params
In reply to Juergen GrossQuoted 30 lines · Juergen Gross
Quoted 17 lines · Daniel Kiper
Quoted 16 lines · Juergen Gross
Xen PVH guests will have the RSDP at an arbitrary address. Support that by passing the RSDP address via the boot parameters to Linux.
The new protocol version 2.14 requires to set version to
0x8000ored with the actually use protocol version (the minimum of the kernel supplied protocol version and the grub2 supported protocol version) if 2.14 or higher are in effect.Signed-off-by Juergen Gross <[email protected]>---
V2: add oring0x8000to version field--- grub-core/loader/i386/linux.c | 9 +++++++++ include/grub/i386/linux.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-)Quoted 11 lines
grub-core/loader/i386/linux.c line 38
Quoted 9 lines
grub-core/loader/i386/linux.c +1
-0@@ -35,6 +35,7 @@#include <grub/i18n.h> #include <grub/lib/cmdline.h> #include <grub/linux.h> +#include <grub/machine/kernel.h> Probably this change belongs to another patch.
Quoted 1 line
I don't think so.
You do not add anything to this header here and out of the blue you include it in this file. So, why it is needed here?
Quoted 13 lines
Quoted 6 lines
Quoted 6 lines
grub-core/loader/i386/linux.c +0
-0GRUB_MOD_LICENSE ("GPLv3+" );@@ -750,6 +751,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), prot_init_space =page_align (prot_size) *3 ; }Quoted 6 lines
grub-core/loader/i386/linux.c grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), · line 757
Quoted 4 lines
grub-core/loader/i386/linux.c +4
-0+#ifdef GRUB_KERNEL_USE_RSDP_ADDR +if (grub_le_to_cpu16 (lh.version) >=0x020e ) + lh.acpi_rsdp_addr =grub_le_to_cpu64 (grub_rsdp_addr); +#endif It seems to me that this belongs to patch #8. Does not it?
Quoted 4 lines
No, it is a generic new interface.
It will be used by PVH first, but can be used in other environments, too.
I do not like this much but if you want me to get it you have to put a blurb in the commit message why this is not enabled here. And when it will be enabled...
Daniel
Juergen Gross
maintainerRe: [PATCH v2 02/18] loader/linux: support passing rsdp address via boot params
Quoted 31 lines · Daniel Kiper
Quoted 30 lines · Juergen Gross
Quoted 28 lines · Daniel Kiper
Quoted 21 lines · Juergen Gross
Xen PVH guests will have the RSDP at an arbitrary address. Support that by passing the RSDP address via the boot parameters to Linux.
The new protocol version 2.14 requires to set version to
0x8000ored with the actually use protocol version (the minimum of the kernel supplied protocol version and the grub2 supported protocol version) if 2.14 or higher are in effect.Signed-off-by Juergen Gross <[email protected]>---
V2: add oring0x8000to version field--- grub-core/loader/i386/linux.c | 9 +++++++++ include/grub/i386/linux.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-)grub-core/loader/i386/linux.c +0
-0grub-core/loader/i386/linux.c line 38
Quoted 4 lines
grub-core/loader/i386/linux.c +1
-0@@ -35,6 +35,7 @@#include <grub/i18n.h> #include <grub/lib/cmdline.h> #include <grub/linux.h> +#include <grub/machine/kernel.h> Probably this change belongs to another patch.
Quoted 4 lines
Quoted 1 line
I don't think so.
You do not add anything to this header here and out of the blue you include it in this file. So, why it is needed here?
Ah, now I see your problem.
machine/kernel.h will be the header which eventually defines GRUB_KERNEL_USE_RSDP_ADDR.
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
grub-core/loader/i386/linux.c grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), · line 757
Quoted 11 lines
grub-core/loader/i386/linux.c +4
-0GRUB_MOD_LICENSE ("GPLv3+" );@@ -750,6 +751,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), prot_init_space =page_align (prot_size) *3 ; } +#ifdef GRUB_KERNEL_USE_RSDP_ADDR +if (grub_le_to_cpu16 (lh.version) >=0x020e ) + lh.acpi_rsdp_addr =grub_le_to_cpu64 (grub_rsdp_addr); +#endif It seems to me that this belongs to patch #8. Does not it?
Quoted 8 lines
Quoted 4 lines
No, it is a generic new interface.
It will be used by PVH first, but can be used in other environments, too.
I do not like this much but if you want me to get it you have to put a blurb in the commit message why this is not enabled here. And when it will be enabled...
Okay, will do.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 02/18] loader/linux: support passing rsdp address via boot params
Quoted 34 lines · Juergen Gross
Quoted 33 lines · Daniel Kiper
Quoted 31 lines · Juergen Gross
Quoted 17 lines · Daniel Kiper
Quoted 16 lines · Juergen Gross
Xen PVH guests will have the RSDP at an arbitrary address. Support that by passing the RSDP address via the boot parameters to Linux.
The new protocol version 2.14 requires to set version to
0x8000ored with the actually use protocol version (the minimum of the kernel supplied protocol version and the grub2 supported protocol version) if 2.14 or higher are in effect.Signed-off-by Juergen Gross <[email protected]>---
V2: add oring0x8000to version field--- grub-core/loader/i386/linux.c | 9 +++++++++ include/grub/i386/linux.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-)Quoted 11 lines
grub-core/loader/i386/linux.c line 38
Quoted 9 lines
grub-core/loader/i386/linux.c +1
-0@@ -35,6 +35,7 @@#include <grub/i18n.h> #include <grub/lib/cmdline.h> #include <grub/linux.h> +#include <grub/machine/kernel.h> Probably this change belongs to another patch.
I don't think so.
Quoted 7 lines
Quoted 2 lines
You do not add anything to this header here and out of the blue you include it in this file. So, why it is needed here?
Ah, now I see your problem.
machine/kernel.hwill be the header which eventually definesGRUB_KERNEL_USE_RSDP_ADDR.
So, please move this to the proper patch.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [PATCH v2 02/18] loader/linux: support passing rsdp address via boot params
Quoted 38 lines · Daniel Kiper
Quoted 37 lines · Juergen Gross
Quoted 35 lines · Daniel Kiper
Quoted 30 lines · Juergen Gross
Quoted 17 lines · Daniel Kiper
Quoted 16 lines · Juergen Gross
Xen PVH guests will have the RSDP at an arbitrary address. Support that by passing the RSDP address via the boot parameters to Linux.
The new protocol version 2.14 requires to set version to
0x8000ored with the actually use protocol version (the minimum of the kernel supplied protocol version and the grub2 supported protocol version) if 2.14 or higher are in effect.Signed-off-by Juergen Gross <[email protected]>---
V2: add oring0x8000to version field--- grub-core/loader/i386/linux.c | 9 +++++++++ include/grub/i386/linux.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-)Quoted 11 lines
grub-core/loader/i386/linux.c line 38
Quoted 9 lines
grub-core/loader/i386/linux.c +1
-0@@ -35,6 +35,7 @@#include <grub/i18n.h> #include <grub/lib/cmdline.h> #include <grub/linux.h> +#include <grub/machine/kernel.h> Probably this change belongs to another patch.
Quoted 1 line
I don't think so.
You do not add anything to this header here and out of the blue you include it in this file. So, why it is needed here?
Quoted 6 lines
Quoted 4 lines
Ah, now I see your problem.
machine/kernel.hwill be the header which eventually definesGRUB_KERNEL_USE_RSDP_ADDR.So, please move this to the proper patch.
Okay, if you like that better.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 02/18] loader/linux: support passing rsdp address via boot params
Quoted 39 lines · Juergen Gross
Quoted 38 lines · Daniel Kiper
Quoted 37 lines · Juergen Gross
Quoted 35 lines · Daniel Kiper
Quoted 30 lines · Juergen Gross
Quoted 17 lines · Daniel Kiper
Quoted 16 lines · Juergen Gross
Xen PVH guests will have the RSDP at an arbitrary address. Support that by passing the RSDP address via the boot parameters to Linux.
The new protocol version 2.14 requires to set version to
0x8000ored with the actually use protocol version (the minimum of the kernel supplied protocol version and the grub2 supported protocol version) if 2.14 or higher are in effect.Signed-off-by Juergen Gross <[email protected]>---
V2: add oring0x8000to version field--- grub-core/loader/i386/linux.c | 9 +++++++++ include/grub/i386/linux.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-)Quoted 11 lines
grub-core/loader/i386/linux.c line 38
Quoted 9 lines
grub-core/loader/i386/linux.c +1
-0@@ -35,6 +35,7 @@#include <grub/i18n.h> #include <grub/lib/cmdline.h> #include <grub/linux.h> +#include <grub/machine/kernel.h> Probably this change belongs to another patch.
Quoted 1 line
I don't think so.
You do not add anything to this header here and out of the blue you include it in this file. So, why it is needed here?
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Ah, now I see your problem.
machine/kernel.hwill be the header which eventually definesGRUB_KERNEL_USE_RSDP_ADDR.So, please move this to the proper patch.
Okay, if you like that better.
Yes, I will. Thanks!
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v2 3/18 xen: carve out grant tab initialization into dedicated function
In reply to Juergen GrossInitialize the grant tab in a dedicated function. This will enable using it for PVH guests, too.
Call the new function from grub_machine_init() as this will later be common between Xen PV and Xen PVH mode.
---
V2: update commit message (Daniel Kiper)
--- grub-core/kern/xen/init.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-)
grub-core/kern/xen/init.c +21 -14
@@ -318,6 +318,25 @@ grub_xenstore_dir (const char *dir,unsigned long gntframe =0 ; +static void +grub_xen_setup_gnttab (void ) +{ +struct gnttab_set_version gnttab_setver; +struct gnttab_setup_table gnttab_setup; + +grub_memset (&gnttab_setver,0 ,sizeof (gnttab_setver)); + + gnttab_setver.version =1 ; +grub_xen_grant_table_op (GNTTABOP_set_version, &gnttab_setver,1 ); + +grub_memset (&gnttab_setup,0 ,sizeof (gnttab_setup)); + gnttab_setup.dom =DOMID_SELF ; + gnttab_setup.nr_frames =1 ; + gnttab_setup.frame_list.p = &gntframe; + +grub_xen_grant_table_op (GNTTABOP_setup_table, &gnttab_setup,1 ); +} +#define MAX_N_UNUSABLE_PAGES 4 static int
@@ -357,26 +376,12 @@ map_all_pages (void) (grub_xen_mfn_t *) grub_xen_start_page_addr->mfn_list;grub_uint64_t *pg = (grub_uint64_t *) window;grub_uint64_t oldpgstart, oldpgend; -struct gnttab_setup_table gnttab_setup; -struct gnttab_set_version gnttab_setver;grub_size_t n_unusable_pages =0 ;struct mmu_update m2p_updates[2 *MAX_N_UNUSABLE_PAGES ];if (total_pages >MAX_TOTAL_PAGES -4 ) total_pages =MAX_TOTAL_PAGES -4 ; -grub_memset (&gnttab_setver,0 ,sizeof (gnttab_setver)); - - gnttab_setver.version =1 ; -grub_xen_grant_table_op (GNTTABOP_set_version, &gnttab_setver,1 ); - -grub_memset (&gnttab_setup,0 ,sizeof (gnttab_setup)); - gnttab_setup.dom =DOMID_SELF ; - gnttab_setup.nr_frames =1 ; - gnttab_setup.frame_list.p = &gntframe; - -grub_xen_grant_table_op (GNTTABOP_setup_table, &gnttab_setup,1 ); -for (j =0 ; j < total_pages - n_unusable_pages; j++)while (!grub_xen_is_page_usable (mfn_list[j])) {
@@ -537,6 +542,8 @@ grub_machine_init (void) +GRUB_KERNEL_MACHINE_MOD_GAP , GRUB_KERNEL_MACHINE_MOD_ALIGN); +grub_xen_setup_gnttab (); +map_all_pages ();grub_console_init ();
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 03/18] xen: carve out grant tab initialization into dedicated function
Quoted 7 lines · Juergen Gross
Initialize the grant tab in a dedicated function. This will enable using it for PVH guests, too.
Call the new function from
grub_machine_init()as this will later be common between Xen PV and Xen PVH mode.Signed-off-by Juergen Gross <[email protected]>
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v2 4/18 xen: prepare common code for Xen PVH support
In reply to Juergen GrossSome common code needs to be special cased for Xen PVH mode. This hits mostly Xen PV mode specific areas.
--- grub-core/kern/i386/tsc.c | 2 +- include/grub/i386/pc/int.h | 3 +++ include/grub/i386/tsc.h | 2 +- include/grub/i386/xen/hypercall.h | 5 ++++- include/grub/kernel.h | 4 +++- 5 files changed, 12 insertions(+), 4 deletions(-)
grub-core/kern/i386/tsc.c +1 -1
@@ -65,7 +65,7 @@ grub_tsc_init (void) tsc_boot_time =grub_get_tsc (); -#ifdef GRUB_MACHINE_XEN +#if defined (GRUB_MACHINE_XEN ) || defined (GRUB_MACHINE_XENPVH ) (void ) (grub_tsc_calibrate_from_xen () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_EFI ) (void ) (grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_pit () ||grub_tsc_calibrate_from_efi () ||calibrate_tsc_hardcode ());
include/grub/i386/pc/int.h +3 -0
@@ -51,9 +51,12 @@ struct grub_bios_int_registers#define GRUB_CPU_INT_FLAGS_DEFAULT 0#endif +#ifndef GRUB_MACHINE_XENPVH void EXPORT_FUNC (grub_bios_interrupt ) (grub_uint8_t intno,struct grub_bios_int_registers *regs) __attribute__ ((regparm (3 ))); +#endif +struct grub_i386_idt {grub_uint16_t limit;
include/grub/i386/tsc.h +1 -1
@@ -54,7 +54,7 @@ grub_get_tsc (void)static __inlineint grub_cpu_is_tsc_supported (void ) { -#ifndef GRUB_MACHINE_XEN +#if !defined(GRUB_MACHINE_XEN ) && !defined(GRUB_MACHINE_XENPVH )grub_uint32_t a,b,c,d;if (!grub_cpu_is_cpuid_supported ())return 0 ;
include/grub/i386/xen/hypercall.h +4 -1
@@ -26,7 +26,10 @@ EXPORT_FUNC (grub_xen_hypercall) (grub_uint32_t callno, grub_uint32_t a0, grub_uint32_t a1, grub_uint32_t a2, grub_uint32_t a3, grub_uint32_t a4, grub_uint32_t a5) -__attribute__ ((regparm (3), cdecl)); +#ifdef GRUB_MACHINE_XEN + __attribute__ ((regparm (3), cdecl)) +#endif + ;static inline int grub_xen_sched_op (int cmd,void *arg)
include/grub/kernel.h +3 -1
@@ -79,7 +79,9 @@ struct grub_module_info64#if defined (GRUB_MACHINE_PCBIOS ) || defined (GRUB_MACHINE_COREBOOT ) \ || defined (GRUB_MACHINE_MULTIBOOT ) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS ) \ || defined (GRUB_MACHINE_MIPS_LOONGSON ) || defined (GRUB_MACHINE_ARC ) \ - || (defined (__sparc__) && defined (GRUB_MACHINE_IEEE1275 )) || defined (GRUB_MACHINE_UBOOT ) || defined (GRUB_MACHINE_XEN ) + || (defined (__sparc__) && defined (GRUB_MACHINE_IEEE1275 )) \ + || defined (GRUB_MACHINE_UBOOT ) || defined (GRUB_MACHINE_XEN ) \ + || defined(GRUB_MACHINE_XENPVH )/* FIXME: stack is between 2 heap regions. Move it. */ #define GRUB_KERNEL_PRELOAD_SPACE_REUSABLE 1#endif
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v2 4/18 xen: prepare common code for Xen PVH support
In reply to Juergen GrossSome common code needs to be special cased for Xen PVH mode. This hits mostly Xen PV mode specific areas.
--- grub-core/kern/i386/tsc.c | 2 +- include/grub/i386/pc/int.h | 3 +++ include/grub/i386/tsc.h | 2 +- include/grub/i386/xen/hypercall.h | 5 ++++- include/grub/kernel.h | 4 +++- 5 files changed, 12 insertions(+), 4 deletions(-)
grub-core/kern/i386/tsc.c +1 -1
@@ -65,7 +65,7 @@ grub_tsc_init (void) tsc_boot_time =grub_get_tsc (); -#ifdef GRUB_MACHINE_XEN +#if defined (GRUB_MACHINE_XEN ) || defined (GRUB_MACHINE_XENPVH ) (void ) (grub_tsc_calibrate_from_xen () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_EFI ) (void ) (grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_pit () ||grub_tsc_calibrate_from_efi () ||calibrate_tsc_hardcode ());
include/grub/i386/pc/int.h +3 -0
@@ -51,9 +51,12 @@ struct grub_bios_int_registers#define GRUB_CPU_INT_FLAGS_DEFAULT 0#endif +#ifndef GRUB_MACHINE_XENPVH void EXPORT_FUNC (grub_bios_interrupt ) (grub_uint8_t intno,struct grub_bios_int_registers *regs) __attribute__ ((regparm (3 ))); +#endif +struct grub_i386_idt {grub_uint16_t limit;
include/grub/i386/tsc.h +1 -1
@@ -54,7 +54,7 @@ grub_get_tsc (void)static __inlineint grub_cpu_is_tsc_supported (void ) { -#ifndef GRUB_MACHINE_XEN +#if !defined(GRUB_MACHINE_XEN ) && !defined(GRUB_MACHINE_XENPVH )grub_uint32_t a,b,c,d;if (!grub_cpu_is_cpuid_supported ())return 0 ;
include/grub/i386/xen/hypercall.h +4 -1
@@ -26,7 +26,10 @@ EXPORT_FUNC (grub_xen_hypercall) (grub_uint32_t callno, grub_uint32_t a0, grub_uint32_t a1, grub_uint32_t a2, grub_uint32_t a3, grub_uint32_t a4, grub_uint32_t a5) -__attribute__ ((regparm (3), cdecl)); +#ifdef GRUB_MACHINE_XEN + __attribute__ ((regparm (3), cdecl)) +#endif + ;static inline int grub_xen_sched_op (int cmd,void *arg)
include/grub/kernel.h +3 -1
@@ -79,7 +79,9 @@ struct grub_module_info64#if defined (GRUB_MACHINE_PCBIOS ) || defined (GRUB_MACHINE_COREBOOT ) \ || defined (GRUB_MACHINE_MULTIBOOT ) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS ) \ || defined (GRUB_MACHINE_MIPS_LOONGSON ) || defined (GRUB_MACHINE_ARC ) \ - || (defined (__sparc__) && defined (GRUB_MACHINE_IEEE1275 )) || defined (GRUB_MACHINE_UBOOT ) || defined (GRUB_MACHINE_XEN ) + || (defined (__sparc__) && defined (GRUB_MACHINE_IEEE1275 )) \ + || defined (GRUB_MACHINE_UBOOT ) || defined (GRUB_MACHINE_XEN ) \ + || defined(GRUB_MACHINE_XENPVH )/* FIXME: stack is between 2 heap regions. Move it. */ #define GRUB_KERNEL_PRELOAD_SPACE_REUSABLE 1#endif
Signature · 1 line
2.16.4
Re: [PATCH v2 04/18] xen: prepare common code for Xen PVH support
Quoted 17 lines · Juergen Gross
Some common code needs to be special cased for Xen PVH mode. This hits mostly Xen PV mode specific areas.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/tsc.c | 2 +- include/grub/i386/pc/int.h | 3 +++ include/grub/i386/tsc.h | 2 +- include/grub/i386/xen/hypercall.h | 5 ++++- include/grub/kernel.h | 4 +++- 5 files changed, 12 insertions(+), 4 deletions(-)grub-core/kern/i386/tsc.c +0
-0
grub-core/kern/i386/tsc.c grub_tsc_init (void) · line 68
Quoted 5 lines
grub-core/kern/i386/tsc.c +1
-1@@ -65,7 +65,7 @@ grub_tsc_init (void) tsc_boot_time =grub_get_tsc (); -#ifdef GRUB_MACHINE_XEN +#if defined (GRUB_MACHINE_XEN ) || defined (GRUB_MACHINE_XENPVH )
s/GRUB_MACHINE_XENPVH/GRUB_MACHINE_XEN_PVH/
Quoted 8 lines
grub-core/kern/i386/tsc.c +0
-0(void ) (grub_tsc_calibrate_from_xen () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_EFI ) (void ) (grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_pit () ||grub_tsc_calibrate_from_efi () ||calibrate_tsc_hardcode ());include/grub/i386/pc/int.h +0
-0
include/grub/i386/pc/int.h struct grub_bios_int_registers · line 58
Quoted 8 lines
include/grub/i386/pc/int.h +2
-0@@ -51,9 +51,12 @@ struct grub_bios_int_registers#define GRUB_CPU_INT_FLAGS_DEFAULT 0#endif +#ifndef GRUB_MACHINE_XENPVH void EXPORT_FUNC (grub_bios_interrupt ) (grub_uint8_t intno,struct grub_bios_int_registers *regs) __attribute__ ((regparm (3 ))); +#endif
Is it an issue with this declaration? I think that you should take care about grub-core/kern/i386/int.S. So, relevant Makefile should be updated instead of this declaration.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [PATCH v2 04/18] xen: prepare common code for Xen PVH support
Quoted 19 lines · Daniel Kiper
Quoted 18 lines · Juergen Gross
Some common code needs to be special cased for Xen PVH mode. This hits mostly Xen PV mode specific areas.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/tsc.c | 2 +- include/grub/i386/pc/int.h | 3 +++ include/grub/i386/tsc.h | 2 +- include/grub/i386/xen/hypercall.h | 5 ++++- include/grub/kernel.h | 4 +++- 5 files changed, 12 insertions(+), 4 deletions(-)grub-core/kern/i386/tsc.c +0
-0@@ -65,7 +65,7 @@ grub_tsc_init (void)
Quoted 6 lines
grub-core/kern/i386/tsc.c grub_tsc_init (void) · line 68
Quoted 4 lines
grub-core/kern/i386/tsc.c +1
-1tsc_boot_time =grub_get_tsc (); -#ifdef GRUB_MACHINE_XEN +#if defined (GRUB_MACHINE_XEN ) || defined (GRUB_MACHINE_XENPVH )s/GRUB_MACHINE_XENPVH/GRUB_MACHINE_XEN_PVH/
Okay.
Quoted 12 lines
Quoted 12 lines
grub-core/kern/i386/tsc.c +0
-0(void ) (grub_tsc_calibrate_from_xen () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_EFI ) (void ) (grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_pit () ||grub_tsc_calibrate_from_efi () ||calibrate_tsc_hardcode ());include/grub/i386/pc/int.h +0
-0@@ -51,9 +51,12 @@ struct grub_bios_int_registers#define GRUB_CPU_INT_FLAGS_DEFAULT 0#endif
Quoted 9 lines
include/grub/i386/pc/int.h struct grub_bios_int_registers · line 58
Quoted 5 lines
include/grub/i386/pc/int.h +2
-0+#ifndef GRUB_MACHINE_XENPVH void EXPORT_FUNC (grub_bios_interrupt ) (grub_uint8_t intno,struct grub_bios_int_registers *regs) __attribute__ ((regparm (3 ))); +#endif Is it an issue with this declaration? I think that you should take care about
grub-core/kern/i386/int.S. So, relevantMakefileshould be updated instead of this declaration.
I'll have a try. I just remember I struggled a lot with this issue when writing the patches.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [PATCH v2 04/18] xen: prepare common code for Xen PVH support
In reply to Daniel KiperQuoted 19 lines · Daniel Kiper
Quoted 18 lines · Juergen Gross
Some common code needs to be special cased for Xen PVH mode. This hits mostly Xen PV mode specific areas.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/tsc.c | 2 +- include/grub/i386/pc/int.h | 3 +++ include/grub/i386/tsc.h | 2 +- include/grub/i386/xen/hypercall.h | 5 ++++- include/grub/kernel.h | 4 +++- 5 files changed, 12 insertions(+), 4 deletions(-)grub-core/kern/i386/tsc.c +0
-0@@ -65,7 +65,7 @@ grub_tsc_init (void)
Quoted 6 lines
grub-core/kern/i386/tsc.c grub_tsc_init (void) · line 68
Quoted 4 lines
grub-core/kern/i386/tsc.c +1
-1tsc_boot_time =grub_get_tsc (); -#ifdef GRUB_MACHINE_XEN +#if defined (GRUB_MACHINE_XEN ) || defined (GRUB_MACHINE_XENPVH )s/GRUB_MACHINE_XENPVH/GRUB_MACHINE_XEN_PVH/
Okay.
Quoted 12 lines
Quoted 12 lines
grub-core/kern/i386/tsc.c +0
-0(void ) (grub_tsc_calibrate_from_xen () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_EFI ) (void ) (grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_pit () ||grub_tsc_calibrate_from_efi () ||calibrate_tsc_hardcode ());include/grub/i386/pc/int.h +0
-0@@ -51,9 +51,12 @@ struct grub_bios_int_registers#define GRUB_CPU_INT_FLAGS_DEFAULT 0#endif
Quoted 9 lines
include/grub/i386/pc/int.h struct grub_bios_int_registers · line 58
Quoted 5 lines
include/grub/i386/pc/int.h +2
-0+#ifndef GRUB_MACHINE_XENPVH void EXPORT_FUNC (grub_bios_interrupt ) (grub_uint8_t intno,struct grub_bios_int_registers *regs) __attribute__ ((regparm (3 ))); +#endif Is it an issue with this declaration? I think that you should take care about
grub-core/kern/i386/int.S. So, relevantMakefileshould be updated instead of this declaration.
I'll have a try. I just remember I struggled a lot with this issue when writing the patches.
Juergen
Juergen Gross
maintainerRe: [PATCH v2 04/18] xen: prepare common code for Xen PVH support
Quoted 51 lines · Juergen Gross
Quoted 19 lines · Daniel Kiper
Quoted 18 lines · Juergen Gross
Some common code needs to be special cased for Xen PVH mode. This hits mostly Xen PV mode specific areas.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/tsc.c | 2 +- include/grub/i386/pc/int.h | 3 +++ include/grub/i386/tsc.h | 2 +- include/grub/i386/xen/hypercall.h | 5 ++++- include/grub/kernel.h | 4 +++- 5 files changed, 12 insertions(+), 4 deletions(-)grub-core/kern/i386/tsc.c +0
-0@@ -65,7 +65,7 @@ grub_tsc_init (void)Quoted 6 lines
grub-core/kern/i386/tsc.c grub_tsc_init (void) · line 68
Quoted 4 lines
grub-core/kern/i386/tsc.c +1
-1tsc_boot_time =grub_get_tsc (); -#ifdef GRUB_MACHINE_XEN +#if defined (GRUB_MACHINE_XEN ) || defined (GRUB_MACHINE_XENPVH )s/GRUB_MACHINE_XENPVH/GRUB_MACHINE_XEN_PVH/
Okay.
Quoted 12 lines
Quoted 12 lines
grub-core/kern/i386/tsc.c +0
-0(void ) (grub_tsc_calibrate_from_xen () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_EFI ) (void ) (grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_pit () ||grub_tsc_calibrate_from_efi () ||calibrate_tsc_hardcode ());include/grub/i386/pc/int.h +0
-0@@ -51,9 +51,12 @@ struct grub_bios_int_registers#define GRUB_CPU_INT_FLAGS_DEFAULT 0#endif Quoted 9 lines
include/grub/i386/pc/int.h struct grub_bios_int_registers · line 58
Quoted 5 lines
include/grub/i386/pc/int.h +2
-0+#ifndef GRUB_MACHINE_XENPVH void EXPORT_FUNC (grub_bios_interrupt ) (grub_uint8_t intno,struct grub_bios_int_registers *regs) __attribute__ ((regparm (3 ))); +#endif Is it an issue with this declaration? I think that you should take care about
grub-core/kern/i386/int.S. So, relevantMakefileshould be updated instead of this declaration.
Quoted 2 lines
I'll have a try. I just remember I struggled a lot with this issue when writing the patches.
Ah, now I've found the problem:
I'm including grub/i386/pc/int.h from grub/i386/xenpvh/int.h in order to avoid having to redefine all the macros and structs in that file.
Unfortunately the EXPORT_FUNC() will make the build fail as in Xen-PVH I don't have the symbol grub_bios_interrupt available.
I see the following solutions:
1. keep the patch as it is now
2. duplicate grub/i386/pc/int.h in grub/i386/xenpvh/int.h without EXPORT_FUNC (grub_bios_interrupt)
3. add a dummy grub_bios_interrupt entry in Xen-PVH code
4. split grub/i386/pc/int.h into int_types.h and int.h with int_types.h containing the stuff I need for Xen-PVH and include int_types.h from grub/i386/pc/int.h and grub/i386/xenpvh/int.h (grub/i386/pc/int.h would contain the EXPORT_FUNC then)
What is your preference?
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 04/18] xen: prepare common code for Xen PVH support
In reply to Juergen GrossQuoted 51 lines · Juergen Gross
Quoted 19 lines · Daniel Kiper
Quoted 18 lines · Juergen Gross
Some common code needs to be special cased for Xen PVH mode. This hits mostly Xen PV mode specific areas.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/tsc.c | 2 +- include/grub/i386/pc/int.h | 3 +++ include/grub/i386/tsc.h | 2 +- include/grub/i386/xen/hypercall.h | 5 ++++- include/grub/kernel.h | 4 +++- 5 files changed, 12 insertions(+), 4 deletions(-)grub-core/kern/i386/tsc.c +0
-0@@ -65,7 +65,7 @@ grub_tsc_init (void)Quoted 6 lines
grub-core/kern/i386/tsc.c grub_tsc_init (void) · line 68
Quoted 4 lines
grub-core/kern/i386/tsc.c +1
-1tsc_boot_time =grub_get_tsc (); -#ifdef GRUB_MACHINE_XEN +#if defined (GRUB_MACHINE_XEN ) || defined (GRUB_MACHINE_XENPVH )s/GRUB_MACHINE_XENPVH/GRUB_MACHINE_XEN_PVH/
Okay.
Quoted 12 lines
Quoted 12 lines
grub-core/kern/i386/tsc.c +0
-0(void ) (grub_tsc_calibrate_from_xen () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_EFI ) (void ) (grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_pit () ||grub_tsc_calibrate_from_efi () ||calibrate_tsc_hardcode ());include/grub/i386/pc/int.h +0
-0@@ -51,9 +51,12 @@ struct grub_bios_int_registers#define GRUB_CPU_INT_FLAGS_DEFAULT 0#endif Quoted 9 lines
include/grub/i386/pc/int.h struct grub_bios_int_registers · line 58
Quoted 5 lines
include/grub/i386/pc/int.h +2
-0+#ifndef GRUB_MACHINE_XENPVH void EXPORT_FUNC (grub_bios_interrupt ) (grub_uint8_t intno,struct grub_bios_int_registers *regs) __attribute__ ((regparm (3 ))); +#endif Is it an issue with this declaration? I think that you should take care about
grub-core/kern/i386/int.S. So, relevantMakefileshould be updated instead of this declaration.
Quoted 2 lines
I'll have a try. I just remember I struggled a lot with this issue when writing the patches.
Ah, now I've found the problem:
I'm including grub/i386/pc/int.h from grub/i386/xenpvh/int.h in order to avoid having to redefine all the macros and structs in that file.
Unfortunately the EXPORT_FUNC() will make the build fail as in Xen-PVH I don't have the symbol grub_bios_interrupt available.
I see the following solutions:
1. keep the patch as it is now
2. duplicate grub/i386/pc/int.h in grub/i386/xenpvh/int.h without EXPORT_FUNC (grub_bios_interrupt)
3. add a dummy grub_bios_interrupt entry in Xen-PVH code
4. split grub/i386/pc/int.h into int_types.h and int.h with int_types.h containing the stuff I need for Xen-PVH and include int_types.h from grub/i386/pc/int.h and grub/i386/xenpvh/int.h (grub/i386/pc/int.h would contain the EXPORT_FUNC then)
What is your preference?
Juergen
Juergen Gross
maintainerPATCH v2 5/18 xen: add some dummy headers for PVH mode
In reply to Juergen GrossXen PVH mode needs some headers including the common i386 headers. Add those to the tree.
--- include/grub/i386/xenpvh/boot.h | 1 + include/grub/i386/xenpvh/console.h | 1 + include/grub/i386/xenpvh/int.h | 1 + include/grub/i386/xenpvh/memory.h | 1 + include/grub/i386/xenpvh/time.h | 1 + 5 files changed, 5 insertions(+) create mode 100644 include/grub/i386/xenpvh/boot.h create mode 100644 include/grub/i386/xenpvh/console.h create mode 100644 include/grub/i386/xenpvh/int.h create mode 100644 include/grub/i386/xenpvh/memory.h create mode 100644 include/grub/i386/xenpvh/time.h
include/grub/i386/xenpvh/boot.h new file +1 -0
@@ -0,0 +1 @@ +#include <grub/i386/pc/boot.h>
include/grub/i386/xenpvh/console.h new file +1 -0
@@ -0,0 +1 @@ +#include <grub/i386/pc/console.h>
include/grub/i386/xenpvh/int.h new file +1 -0
@@ -0,0 +1 @@ +#include <grub/i386/pc/int.h>
include/grub/i386/xenpvh/memory.h new file +1 -0
@@ -0,0 +1 @@ +#include <grub/i386/coreboot/memory.h>
include/grub/i386/xenpvh/time.h new file +1 -0
@@ -0,0 +1 @@ +#include <grub/i386/pc/time.h>
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v2 5/18 xen: add some dummy headers for PVH mode
In reply to Juergen GrossXen PVH mode needs some headers including the common i386 headers. Add those to the tree.
--- include/grub/i386/xenpvh/boot.h | 1 + include/grub/i386/xenpvh/console.h | 1 + include/grub/i386/xenpvh/int.h | 1 + include/grub/i386/xenpvh/memory.h | 1 + include/grub/i386/xenpvh/time.h | 1 + 5 files changed, 5 insertions(+) create mode 100644 include/grub/i386/xenpvh/boot.h create mode 100644 include/grub/i386/xenpvh/console.h create mode 100644 include/grub/i386/xenpvh/int.h create mode 100644 include/grub/i386/xenpvh/memory.h create mode 100644 include/grub/i386/xenpvh/time.h
include/grub/i386/xenpvh/boot.h new file +1 -0
@@ -0,0 +1 @@ +#include <grub/i386/pc/boot.h>
include/grub/i386/xenpvh/console.h new file +1 -0
@@ -0,0 +1 @@ +#include <grub/i386/pc/console.h>
include/grub/i386/xenpvh/int.h new file +1 -0
@@ -0,0 +1 @@ +#include <grub/i386/pc/int.h>
include/grub/i386/xenpvh/memory.h new file +1 -0
@@ -0,0 +1 @@ +#include <grub/i386/coreboot/memory.h>
include/grub/i386/xenpvh/time.h new file +1 -0
@@ -0,0 +1 @@ +#include <grub/i386/pc/time.h>
Signature · 1 line
2.16.4
Re: [PATCH v2 05/18] xen: add some dummy headers for PVH mode
Quoted 51 lines · Juergen Gross
Xen PVH mode needs some headers including the common i386 headers. Add those to the tree.
Signed-off-by Juergen Gross <[email protected]>--- include/grub/i386/xenpvh/boot.h | 1 + include/grub/i386/xenpvh/console.h | 1 + include/grub/i386/xenpvh/int.h | 1 + include/grub/i386/xenpvh/memory.h | 1 + include/grub/i386/xenpvh/time.h | 1 + 5 files changed, 5 insertions(+) create mode 100644 include/grub/i386/xenpvh/boot.h create mode 100644 include/grub/i386/xenpvh/console.h create mode 100644 include/grub/i386/xenpvh/int.h create mode 100644 include/grub/i386/xenpvh/memory.h create mode 100644 include/grub/i386/xenpvh/time.hinclude/grub/i386/xenpvh/boot.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/pc/boot.h> include/grub/i386/xenpvh/console.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/pc/console.h> include/grub/i386/xenpvh/int.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/pc/int.h> include/grub/i386/xenpvh/memory.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/coreboot/memory.h> include/grub/i386/xenpvh/time.h new file +0
-0
include/grub/i386/xenpvh/time.h line 1
Quoted 1 line
include/grub/i386/xenpvh/time.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/pc/time.h>
I do not understand why we need these files. And commit message just states just that we need them. However, it says nothing why... So, why? Who will use them?
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [PATCH v2 05/18] xen: add some dummy headers for PVH mode
Quoted 49 lines · Daniel Kiper
Quoted 48 lines · Juergen Gross
Xen PVH mode needs some headers including the common i386 headers. Add those to the tree.
Signed-off-by Juergen Gross <[email protected]>--- include/grub/i386/xenpvh/boot.h | 1 + include/grub/i386/xenpvh/console.h | 1 + include/grub/i386/xenpvh/int.h | 1 + include/grub/i386/xenpvh/memory.h | 1 + include/grub/i386/xenpvh/time.h | 1 + 5 files changed, 5 insertions(+) create mode 100644 include/grub/i386/xenpvh/boot.h create mode 100644 include/grub/i386/xenpvh/console.h create mode 100644 include/grub/i386/xenpvh/int.h create mode 100644 include/grub/i386/xenpvh/memory.h create mode 100644 include/grub/i386/xenpvh/time.hinclude/grub/i386/xenpvh/boot.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/pc/boot.h> include/grub/i386/xenpvh/console.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/pc/console.h> include/grub/i386/xenpvh/int.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/pc/int.h> include/grub/i386/xenpvh/memory.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/coreboot/memory.h> include/grub/i386/xenpvh/time.h new file +0
-0
Quoted 8 lines
include/grub/i386/xenpvh/time.h line 1
Quoted 4 lines
include/grub/i386/xenpvh/time.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/pc/time.h> I do not understand why we need these files. And commit message just states just that we need them. However, it says nothing why... So, why? Who will use them?
Any source including grub/machine/*.h
I'll make the commit message more verbose in this regard.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [PATCH v2 05/18] xen: add some dummy headers for PVH mode
In reply to Daniel KiperQuoted 49 lines · Daniel Kiper
Quoted 48 lines · Juergen Gross
Xen PVH mode needs some headers including the common i386 headers. Add those to the tree.
Signed-off-by Juergen Gross <[email protected]>--- include/grub/i386/xenpvh/boot.h | 1 + include/grub/i386/xenpvh/console.h | 1 + include/grub/i386/xenpvh/int.h | 1 + include/grub/i386/xenpvh/memory.h | 1 + include/grub/i386/xenpvh/time.h | 1 + 5 files changed, 5 insertions(+) create mode 100644 include/grub/i386/xenpvh/boot.h create mode 100644 include/grub/i386/xenpvh/console.h create mode 100644 include/grub/i386/xenpvh/int.h create mode 100644 include/grub/i386/xenpvh/memory.h create mode 100644 include/grub/i386/xenpvh/time.hinclude/grub/i386/xenpvh/boot.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/pc/boot.h> include/grub/i386/xenpvh/console.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/pc/console.h> include/grub/i386/xenpvh/int.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/pc/int.h> include/grub/i386/xenpvh/memory.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/coreboot/memory.h> include/grub/i386/xenpvh/time.h new file +0
-0
Quoted 8 lines
include/grub/i386/xenpvh/time.h line 1
Quoted 4 lines
include/grub/i386/xenpvh/time.h new file +1
-0@@ -0,0 +1 @@ +#include <grub/i386/pc/time.h> I do not understand why we need these files. And commit message just states just that we need them. However, it says nothing why... So, why? Who will use them?
Any source including grub/machine/*.h
I'll make the commit message more verbose in this regard.
Juergen
Juergen Gross
maintainerPATCH v2 6/18 xen: rearrange xen/init.c to prepare it for Xen PVH mode
In reply to Juergen GrossRearrange grub-core/kern/xen/init.c to prepare adding PVH mode support to it. This includes putting some code under #ifdef GRUB_MACHINE_XEN as it will not be used when running as PVH.
--- grub-core/kern/xen/init.c | 60 +++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 26 deletions(-)
grub-core/kern/xen/init.c +34 -26
@@ -41,9 +41,11 @@ grub_size_t grub_xen_n_allocated_shared_pages;static grub_xen_mfn_t grub_xen_ptr2mfn (void *ptr) { +#ifdef GRUB_MACHINE_XEN grub_xen_mfn_t *mfn_list = (grub_xen_mfn_t *) grub_xen_start_page_addr->mfn_list;return mfn_list[(grub_addr_t ) ptr >>GRUB_XEN_LOG_PAGE_SIZE ]; +#endif } void *
@@ -104,18 +106,6 @@ grub_machine_get_bootlocation (char **device __attribute__ ((unused)), { } -static grub_uint8_t window[GRUB_XEN_PAGE_SIZE] - __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE))); - -#ifdef __x86_64__ -#define NUMBER_OF_LEVELS 4 -#else -#define NUMBER_OF_LEVELS 3 -#endif - -#define LOG_POINTERS_PER_PAGE 9 -#define POINTERS_PER_PAGE (1 << LOG_POINTERS_PER_PAGE) -void grub_xen_store_send (const void *buf_,grub_size_t len) {
@@ -337,6 +327,19 @@ grub_xen_setup_gnttab (void)grub_xen_grant_table_op (GNTTABOP_setup_table, &gnttab_setup,1 ); } +#ifdef GRUB_MACHINE_XEN +static grub_uint8_t window[GRUB_XEN_PAGE_SIZE] + __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE))); + +#ifdef __x86_64__ +#define NUMBER_OF_LEVELS 4 +#else +#define NUMBER_OF_LEVELS 3 +#endif + +#define LOG_POINTERS_PER_PAGE 9 +#define POINTERS_PER_PAGE (1 << LOG_POINTERS_PER_PAGE) +#define MAX_N_UNUSABLE_PAGES 4 static int
@@ -529,13 +532,30 @@ map_all_pages (void)grub_mm_init_region ((void *) heap_start, heap_end - heap_start); } +grub_err_t +grub_machine_mmap_iterate (grub_memory_hook_t hook,void *hook_data) +{ +grub_uint64_t total_pages = grub_xen_start_page_addr->nr_pages; +grub_uint64_t usable_pages = grub_xen_start_page_addr->pt_base >>12 ; +if (hook (0 ,page2offset (usable_pages),GRUB_MEMORY_AVAILABLE , hook_data)) +return GRUB_ERR_NONE ; + +hook (page2offset (usable_pages),page2offset (total_pages - usable_pages), +GRUB_MEMORY_RESERVED , hook_data); + +return GRUB_ERR_NONE ; +} +#endif +extern char _end[];void grub_machine_init (void ) { +#ifdef GRUB_MACHINE_XEN #ifdef __i386__grub_xen_vm_assist (VMASST_CMD_enable, VMASST_TYPE_pae_extended_cr3); +#endif #endif grub_modbase = ALIGN_UP ((grub_addr_t) _end
@@ -544,7 +564,9 @@ grub_machine_init (void)grub_xen_setup_gnttab (); +#ifdef GRUB_MACHINE_XEN map_all_pages (); +#endif grub_console_init ();
@@ -571,17 +593,3 @@ grub_machine_fini (int flags __attribute__ ((unused)))grub_xendisk_fini ();grub_boot_fini (); } - -grub_err_t -grub_machine_mmap_iterate (grub_memory_hook_t hook,void *hook_data) -{ -grub_uint64_t total_pages = grub_xen_start_page_addr->nr_pages; -grub_uint64_t usable_pages = grub_xen_start_page_addr->pt_base >>12 ; -if (hook (0 ,page2offset (usable_pages),GRUB_MEMORY_AVAILABLE , hook_data)) -return GRUB_ERR_NONE ; - -hook (page2offset (usable_pages),page2offset (total_pages - usable_pages), -GRUB_MEMORY_RESERVED , hook_data); - -return GRUB_ERR_NONE ; -}
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 06/18] xen: rearrange xen/init.c to prepare it for Xen PVH mode
Quoted 5 lines · Juergen Gross
Rearrange
grub-core/kern/xen/init.cto prepare adding PVH mode support to it. This includes putting some code under #ifdefGRUB_MACHINE_XENas it will not be used when running as PVH.Signed-off-by Juergen Gross <[email protected]>
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v2 7/18 xen: add PVH specific defines to offset.h
In reply to Juergen Grossinclude/grub/offsets.h needs some defines for Xen PVH mode.
Add them. While at it line up the values in the surrounding lines to start at the same column.
--- include/grub/offsets.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
include/grub/offsets.h +12 -9
@@ -36,9 +36,10 @@#define GRUB_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE (0x9000-0x8200)/* The segment where the kernel is loaded. */ -#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800 +#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800 -#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000 +#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000 +#define GRUB_KERNEL_I386_XENPVH_LINK_ADDR 0x100000/* The upper memory area (starting at 640 kiB). */ #define GRUB_MEMORY_I386_PC_UPPER 0xa0000
@@ -101,15 +102,17 @@#define GRUB_KERNEL_I386_MULTIBOOT_MOD_ALIGN GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN#define GRUB_KERNEL_X86_64_XEN_MOD_ALIGN 0x8 -#define GRUB_KERNEL_I386_XEN_MOD_ALIGN 0x8 +#define GRUB_KERNEL_I386_XEN_MOD_ALIGN 0x8 +#define GRUB_KERNEL_I386_XENPVH_MOD_ALIGN 0x8/* Non-zero value is only needed for PowerMacs. */ -#define GRUB_KERNEL_X86_64_XEN_MOD_GAP 0x0 -#define GRUB_KERNEL_I386_XEN_MOD_GAP 0x0 -#define GRUB_KERNEL_I386_IEEE1275_MOD_GAP 0x0 -#define GRUB_KERNEL_I386_COREBOOT_MOD_GAP 0x0 -#define GRUB_KERNEL_SPARC64_IEEE1275_MOD_GAP 0x0 -#define GRUB_KERNEL_ARM_UBOOT_MOD_GAP 0x0 +#define GRUB_KERNEL_X86_64_XEN_MOD_GAP 0x0 +#define GRUB_KERNEL_I386_XEN_MOD_GAP 0x0 +#define GRUB_KERNEL_I386_XENPVH_MOD_GAP 0x0 +#define GRUB_KERNEL_I386_IEEE1275_MOD_GAP 0x0 +#define GRUB_KERNEL_I386_COREBOOT_MOD_GAP 0x0 +#define GRUB_KERNEL_SPARC64_IEEE1275_MOD_GAP 0x0 +#define GRUB_KERNEL_ARM_UBOOT_MOD_GAP 0x0#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000#define GRUB_KERNEL_SPARC64_IEEE1275_LOG_MOD_ALIGN 3
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 07/18] xen: add PVH specific defines to offset.h
Quoted 15 lines · Juergen Gross
include/grub/offsets.hneeds some defines for Xen PVH mode.Add them. While at it line up the values in the surrounding lines to start at the same column.
Signed-off-by Juergen Gross <[email protected]>--- include/grub/offsets.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)include/grub/offsets.h +0
-0
include/grub/offsets.h line 42
Quoted 9 lines
include/grub/offsets.h +3
-2@@ -36,9 +36,10 @@#define GRUB_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE (0x9000-0x8200)/* The segment where the kernel is loaded. */ -#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800 +#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800 -#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000 +#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000 +#define GRUB_KERNEL_I386_XENPVH_LINK_ADDR 0x100000
s/XENPVH/XEN_PVH/ In general I prefer XEN_PVH instead of XENPVH. So, please update them all where possible. Not only in this patch.
include/grub/offsets.h line 106
Quoted 9 lines
include/grub/offsets.h +2
-1/* The upper memory area (starting at 640 kiB). */ #define GRUB_MEMORY_I386_PC_UPPER 0xa0000@@ -101,15 +102,17 @@#define GRUB_KERNEL_I386_MULTIBOOT_MOD_ALIGN GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN#define GRUB_KERNEL_X86_64_XEN_MOD_ALIGN 0x8 -#define GRUB_KERNEL_I386_XEN_MOD_ALIGN 0x8 +#define GRUB_KERNEL_I386_XEN_MOD_ALIGN 0x8 +#define GRUB_KERNEL_I386_XENPVH_MOD_ALIGN 0x8
Ditto.
include/grub/offsets.h line 111
Quoted 10 lines
include/grub/offsets.h +3
-6/* Non-zero value is only needed for PowerMacs. */ -#define GRUB_KERNEL_X86_64_XEN_MOD_GAP 0x0 -#define GRUB_KERNEL_I386_XEN_MOD_GAP 0x0 -#define GRUB_KERNEL_I386_IEEE1275_MOD_GAP 0x0 -#define GRUB_KERNEL_I386_COREBOOT_MOD_GAP 0x0 -#define GRUB_KERNEL_SPARC64_IEEE1275_MOD_GAP 0x0 -#define GRUB_KERNEL_ARM_UBOOT_MOD_GAP 0x0 +#define GRUB_KERNEL_X86_64_XEN_MOD_GAP 0x0 +#define GRUB_KERNEL_I386_XEN_MOD_GAP 0x0 +#define GRUB_KERNEL_I386_XENPVH_MOD_GAP 0x0
Ditto.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 07/18] xen: add PVH specific defines to offset.h
In reply to Juergen GrossQuoted 15 lines · Juergen Gross
include/grub/offsets.hneeds some defines for Xen PVH mode.Add them. While at it line up the values in the surrounding lines to start at the same column.
Signed-off-by Juergen Gross <[email protected]>--- include/grub/offsets.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)include/grub/offsets.h +0
-0
include/grub/offsets.h line 42
Quoted 9 lines
include/grub/offsets.h +3
-2@@ -36,9 +36,10 @@#define GRUB_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE (0x9000-0x8200)/* The segment where the kernel is loaded. */ -#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800 +#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800 -#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000 +#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000 +#define GRUB_KERNEL_I386_XENPVH_LINK_ADDR 0x100000
s/XENPVH/XEN_PVH/ In general I prefer XEN_PVH instead of XENPVH. So, please update them all where possible. Not only in this patch.
include/grub/offsets.h line 106
Quoted 9 lines
include/grub/offsets.h +2
-1/* The upper memory area (starting at 640 kiB). */ #define GRUB_MEMORY_I386_PC_UPPER 0xa0000@@ -101,15 +102,17 @@#define GRUB_KERNEL_I386_MULTIBOOT_MOD_ALIGN GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN#define GRUB_KERNEL_X86_64_XEN_MOD_ALIGN 0x8 -#define GRUB_KERNEL_I386_XEN_MOD_ALIGN 0x8 +#define GRUB_KERNEL_I386_XEN_MOD_ALIGN 0x8 +#define GRUB_KERNEL_I386_XENPVH_MOD_ALIGN 0x8
Ditto.
include/grub/offsets.h line 111
Quoted 10 lines
include/grub/offsets.h +3
-6/* Non-zero value is only needed for PowerMacs. */ -#define GRUB_KERNEL_X86_64_XEN_MOD_GAP 0x0 -#define GRUB_KERNEL_I386_XEN_MOD_GAP 0x0 -#define GRUB_KERNEL_I386_IEEE1275_MOD_GAP 0x0 -#define GRUB_KERNEL_I386_COREBOOT_MOD_GAP 0x0 -#define GRUB_KERNEL_SPARC64_IEEE1275_MOD_GAP 0x0 -#define GRUB_KERNEL_ARM_UBOOT_MOD_GAP 0x0 +#define GRUB_KERNEL_X86_64_XEN_MOD_GAP 0x0 +#define GRUB_KERNEL_I386_XEN_MOD_GAP 0x0 +#define GRUB_KERNEL_I386_XENPVH_MOD_GAP 0x0
Ditto.
Daniel
Juergen Gross
maintainerRe: [PATCH v2 07/18] xen: add PVH specific defines to offset.h
Quoted 22 lines · Daniel Kiper
Quoted 21 lines · Juergen Gross
include/grub/offsets.hneeds some defines for Xen PVH mode.Add them. While at it line up the values in the surrounding lines to start at the same column.
Signed-off-by Juergen Gross <[email protected]>--- include/grub/offsets.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)include/grub/offsets.h +1
-1@@ -36,9 +36,10 @@#define GRUB_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE (0x9000-0x8200)/* The segment where the kernel is loaded. */ -#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800 +#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800
Quoted 6 lines
include/grub/offsets.h line 42
Quoted 3 lines
include/grub/offsets.h +2
-1-#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000 +#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000 +#define GRUB_KERNEL_I386_XENPVH_LINK_ADDR 0x100000s/XENPVH/XEN_PVH/ In general I prefer
XEN_PVHinstead of XENPVH. So, please update them all where possible. Not only in this patch.
Does this apply to path names as well (e.g. include/grub/i386/xenpvh/) ? Or do you mean macros/symbols only?
BTW: if yes, this would affect the visible platform name, too.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 07/18] xen: add PVH specific defines to offset.h
In reply to Daniel KiperQuoted 22 lines · Daniel Kiper
Quoted 21 lines · Juergen Gross
include/grub/offsets.hneeds some defines for Xen PVH mode.Add them. While at it line up the values in the surrounding lines to start at the same column.
Signed-off-by Juergen Gross <[email protected]>--- include/grub/offsets.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)include/grub/offsets.h +1
-1@@ -36,9 +36,10 @@#define GRUB_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE (0x9000-0x8200)/* The segment where the kernel is loaded. */ -#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800 +#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800
Quoted 6 lines
include/grub/offsets.h line 42
Quoted 3 lines
include/grub/offsets.h +2
-1-#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000 +#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000 +#define GRUB_KERNEL_I386_XENPVH_LINK_ADDR 0x100000s/XENPVH/XEN_PVH/ In general I prefer
XEN_PVHinstead of XENPVH. So, please update them all where possible. Not only in this patch.
Does this apply to path names as well (e.g. include/grub/i386/xenpvh/) ? Or do you mean macros/symbols only?
BTW: if yes, this would affect the visible platform name, too.
Juergen
Juergen Gross
maintainerPATCH v2 8/18 xen: add basic hooks for PVH in current code
In reply to Juergen GrossAdd the hooks to current code needed for Xen PVH.
--- grub-core/kern/i386/xen/pvh.c | 36 +++++++++++++++++++++++++++++++++++ grub-core/kern/i386/xen/startup_pvh.S | 29 ++++++++++++++++++++++++++++ grub-core/kern/xen/init.c | 6 ++++++ include/grub/i386/xenpvh/kernel.h | 30 +++++++++++++++++++++++++++++ include/grub/xen.h | 6 ++++++ 5 files changed, 107 insertions(+) create mode 100644 grub-core/kern/i386/xen/pvh.c create mode 100644 grub-core/kern/i386/xen/startup_pvh.S create mode 100644 include/grub/i386/xenpvh/kernel.h
grub-core/kern/i386/xen/pvh.c new file +36 -0
@@ -0,0 +1,36 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2011 Free Software Foundation, Inc. +* +* GRUB is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GRUB is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GRUB. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <grub/kernel.h> +#include <grub/misc.h> +#include <grub/memory.h> +#include <grub/mm.h> +#include <grub/xen.h> +#include <grub/machine/kernel.h> + +grub_uint64_t grub_rsdp_addr; + +void +grub_xen_setup_pvh (void ) +{ +} + +grub_err_t +grub_machine_mmap_iterate (grub_memory_hook_t hook,void *hook_data) +{ +}
grub-core/kern/i386/xen/startup_pvh.S new file +29 -0
@@ -0,0 +1,29 @@ +/* startup.S - bootstrap GRUB itself */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <config.h> +#include <grub/symbol.h> + + .file "startup_pvh.S" + .text + +/* Saved pointer to start info structure. */ + .globl pvh_start_info +pvh_start_info: + .long 0
grub-core/kern/xen/init.c +6 -0
@@ -45,6 +45,8 @@ grub_xen_ptr2mfn (void *ptr)grub_xen_mfn_t *mfn_list = (grub_xen_mfn_t *) grub_xen_start_page_addr->mfn_list;return mfn_list[(grub_addr_t ) ptr >>GRUB_XEN_LOG_PAGE_SIZE ]; +#else +return (grub_addr_t ) ptr >>GRUB_XEN_LOG_PAGE_SIZE ;#endif }
@@ -562,6 +564,10 @@ grub_machine_init (void) +GRUB_KERNEL_MACHINE_MOD_GAP , GRUB_KERNEL_MACHINE_MOD_ALIGN); +#ifdef GRUB_MACHINE_XENPVH +grub_xen_setup_pvh (); +#endif +grub_xen_setup_gnttab ();#ifdef GRUB_MACHINE_XEN
include/grub/i386/xenpvh/kernel.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2002,2005,2006,2007,2008,2009 Free Software Foundation, Inc. +* +* GRUB is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GRUB is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GRUB. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef GRUB_KERNEL_MACHINE_HEADER +#define GRUB_KERNEL_MACHINE_HEADER 1 + +#ifndef ASM_FILE + +#define GRUB_KERNEL_USE_RSDP_ADDR 1 + +extern grub_uint64_t EXPORT_VAR (grub_rsdp_addr ); + +#endif /* ! ASM_FILE */ + +#endif /* GRUB_KERNEL_MACHINE_HEADER */
include/grub/xen.h +6 -0
@@ -43,6 +43,7 @@ typedef grub_uint64_t uint64_t;#include <xen/sched.h> #include <xen/grant_table.h> +#include <xen/hvm/start_info.h> #include <xen/io/console.h> #include <xen/io/xs_wire.h> #include <xen/io/xenbus.h>
@@ -95,6 +96,11 @@ typedef grub_uint64_t grub_xen_mfn_t;typedef grub_uint32_t grub_xen_mfn_t ;#endif typedef unsigned int grub_xen_evtchn_t ; + +#ifdef GRUB_MACHINE_XENPVH +extern struct hvm_start_info *pvh_start_info; +void grub_xen_setup_pvh (void ); +#endif #endif #endif
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 08/18] xen: add basic hooks for PVH in current code
Quoted 1 line · Juergen Gross
Add the hooks to current code needed for Xen PVH.
I am not against the code itself but it would be nice to know why you add, AIUI, just stubs here which will be filled with proper code later.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 08/18] xen: add basic hooks for PVH in current code
In reply to Juergen GrossQuoted 1 line · Juergen Gross
Add the hooks to current code needed for Xen PVH.
I am not against the code itself but it would be nice to know why you add, AIUI, just stubs here which will be filled with proper code later.
Daniel
Juergen Gross
maintainerRe: [PATCH v2 08/18] xen: add basic hooks for PVH in current code
Quoted 5 lines · Daniel Kiper
Quoted 1 line · Juergen Gross
Add the hooks to current code needed for Xen PVH.
I am not against the code itself but it would be nice to know why you add, AIUI, just stubs here which will be filled with proper code later.
You requested a split of the patch adding PVH stuff. This is the result of that request.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 08/18] xen: add basic hooks for PVH in current code
In reply to Daniel KiperQuoted 5 lines · Daniel Kiper
Quoted 1 line · Juergen Gross
Add the hooks to current code needed for Xen PVH.
I am not against the code itself but it would be nice to know why you add, AIUI, just stubs here which will be filled with proper code later.
You requested a split of the patch adding PVH stuff. This is the result of that request.
Juergen
Re: [PATCH v2 08/18] xen: add basic hooks for PVH in current code
In reply to Juergen GrossQuoted 20 lines · Juergen Gross
Add the hooks to current code needed for Xen PVH.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 36 +++++++++++++++++++++++++++++++++++ grub-core/kern/i386/xen/startup_pvh.S | 29 ++++++++++++++++++++++++++++ grub-core/kern/xen/init.c | 6 ++++++ include/grub/i386/xenpvh/kernel.h | 30 +++++++++++++++++++++++++++++ include/grub/xen.h | 6 ++++++ 5 files changed, 107 insertions(+) create mode 100644 grub-core/kern/i386/xen/pvh.c create mode 100644 grub-core/kern/i386/xen/startup_pvh.S create mode 100644 include/grub/i386/xenpvh/kernel.hgrub-core/kern/i386/xen/pvh.c new file +0
-0
grub-core/kern/i386/xen/pvh.c line 3
Quoted 3 lines
grub-core/kern/i386/xen/pvh.c new file +3
-0@@ -0,0 +1,36 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2011 Free Software Foundation, Inc.
Isn't this header (and the ones below) kind of off at least year wise?
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 08/18] xen: add basic hooks for PVH in current code
In reply to Juergen GrossQuoted 20 lines · Juergen Gross
Add the hooks to current code needed for Xen PVH.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 36 +++++++++++++++++++++++++++++++++++ grub-core/kern/i386/xen/startup_pvh.S | 29 ++++++++++++++++++++++++++++ grub-core/kern/xen/init.c | 6 ++++++ include/grub/i386/xenpvh/kernel.h | 30 +++++++++++++++++++++++++++++ include/grub/xen.h | 6 ++++++ 5 files changed, 107 insertions(+) create mode 100644 grub-core/kern/i386/xen/pvh.c create mode 100644 grub-core/kern/i386/xen/startup_pvh.S create mode 100644 include/grub/i386/xenpvh/kernel.hgrub-core/kern/i386/xen/pvh.c new file +0
-0
grub-core/kern/i386/xen/pvh.c line 3
Quoted 3 lines
grub-core/kern/i386/xen/pvh.c new file +3
-0@@ -0,0 +1,36 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2011 Free Software Foundation, Inc.
Isn't this header (and the ones below) kind of off at least year wise?
Roger.
Juergen Gross
maintainerRe: [PATCH v2 08/18] xen: add basic hooks for PVH in current code
Quoted 15 lines · Roger Pau Monné
Quoted 14 lines · Juergen Gross
Add the hooks to current code needed for Xen PVH.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 36 +++++++++++++++++++++++++++++++++++ grub-core/kern/i386/xen/startup_pvh.S | 29 ++++++++++++++++++++++++++++ grub-core/kern/xen/init.c | 6 ++++++ include/grub/i386/xenpvh/kernel.h | 30 +++++++++++++++++++++++++++++ include/grub/xen.h | 6 ++++++ 5 files changed, 107 insertions(+) create mode 100644 grub-core/kern/i386/xen/pvh.c create mode 100644 grub-core/kern/i386/xen/startup_pvh.S create mode 100644 include/grub/i386/xenpvh/kernel.h
Quoted 12 lines
grub-core/kern/i386/xen/pvh.c line 3
Quoted 9 lines
grub-core/kern/i386/xen/pvh.c new file +3
-0@@ -0,0 +1,36 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2011 Free Software Foundation, Inc. Isn't this header (and the ones below) kind of off at least year wise?
Hmm, only a little bit :-)
Will update.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 08/18] xen: add basic hooks for PVH in current code
In reply to Roger Pau MonnéQuoted 15 lines · Roger Pau Monné
Quoted 14 lines · Juergen Gross
Add the hooks to current code needed for Xen PVH.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 36 +++++++++++++++++++++++++++++++++++ grub-core/kern/i386/xen/startup_pvh.S | 29 ++++++++++++++++++++++++++++ grub-core/kern/xen/init.c | 6 ++++++ include/grub/i386/xenpvh/kernel.h | 30 +++++++++++++++++++++++++++++ include/grub/xen.h | 6 ++++++ 5 files changed, 107 insertions(+) create mode 100644 grub-core/kern/i386/xen/pvh.c create mode 100644 grub-core/kern/i386/xen/startup_pvh.S create mode 100644 include/grub/i386/xenpvh/kernel.h
Quoted 12 lines
grub-core/kern/i386/xen/pvh.c line 3
Quoted 9 lines
grub-core/kern/i386/xen/pvh.c new file +3
-0@@ -0,0 +1,36 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2011 Free Software Foundation, Inc. Isn't this header (and the ones below) kind of off at least year wise?
Hmm, only a little bit :-)
Will update.
Juergen
Re: [PATCH v2 08/18] xen: add basic hooks for PVH in current code
Quoted 29 lines · Juergen Gross
Quoted 15 lines · Roger Pau Monné
Quoted 14 lines · Juergen Gross
Add the hooks to current code needed for Xen PVH.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 36 +++++++++++++++++++++++++++++++++++ grub-core/kern/i386/xen/startup_pvh.S | 29 ++++++++++++++++++++++++++++ grub-core/kern/xen/init.c | 6 ++++++ include/grub/i386/xenpvh/kernel.h | 30 +++++++++++++++++++++++++++++ include/grub/xen.h | 6 ++++++ 5 files changed, 107 insertions(+) create mode 100644 grub-core/kern/i386/xen/pvh.c create mode 100644 grub-core/kern/i386/xen/startup_pvh.S create mode 100644 include/grub/i386/xenpvh/kernel.hQuoted 12 lines
grub-core/kern/i386/xen/pvh.c line 3
Quoted 9 lines
grub-core/kern/i386/xen/pvh.c new file +3
-0@@ -0,0 +1,36 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2011 Free Software Foundation, Inc. Isn't this header (and the ones below) kind of off at least year wise?
Quoted 3 lines
Hmm, only a little bit :-)
Will update.
Please do this for all headers in the patchset
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 08/18] xen: add basic hooks for PVH in current code
In reply to Juergen GrossQuoted 29 lines · Juergen Gross
Quoted 15 lines · Roger Pau Monné
Quoted 14 lines · Juergen Gross
Add the hooks to current code needed for Xen PVH.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 36 +++++++++++++++++++++++++++++++++++ grub-core/kern/i386/xen/startup_pvh.S | 29 ++++++++++++++++++++++++++++ grub-core/kern/xen/init.c | 6 ++++++ include/grub/i386/xenpvh/kernel.h | 30 +++++++++++++++++++++++++++++ include/grub/xen.h | 6 ++++++ 5 files changed, 107 insertions(+) create mode 100644 grub-core/kern/i386/xen/pvh.c create mode 100644 grub-core/kern/i386/xen/startup_pvh.S create mode 100644 include/grub/i386/xenpvh/kernel.hQuoted 12 lines
grub-core/kern/i386/xen/pvh.c line 3
Quoted 9 lines
grub-core/kern/i386/xen/pvh.c new file +3
-0@@ -0,0 +1,36 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2011 Free Software Foundation, Inc. Isn't this header (and the ones below) kind of off at least year wise?
Quoted 3 lines
Hmm, only a little bit :-)
Will update.
Please do this for all headers in the patchset
Daniel
Juergen Gross
maintainerRe: [PATCH v2 08/18] xen: add basic hooks for PVH in current code
Quoted 30 lines · Daniel Kiper
Quoted 29 lines · Juergen Gross
Quoted 27 lines · Roger Pau Monné
Quoted 20 lines · Juergen Gross
Add the hooks to current code needed for Xen PVH.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 36 +++++++++++++++++++++++++++++++++++ grub-core/kern/i386/xen/startup_pvh.S | 29 ++++++++++++++++++++++++++++ grub-core/kern/xen/init.c | 6 ++++++ include/grub/i386/xenpvh/kernel.h | 30 +++++++++++++++++++++++++++++ include/grub/xen.h | 6 ++++++ 5 files changed, 107 insertions(+) create mode 100644 grub-core/kern/i386/xen/pvh.c create mode 100644 grub-core/kern/i386/xen/startup_pvh.S create mode 100644 include/grub/i386/xenpvh/kernel.hgrub-core/kern/i386/xen/pvh.c new file +0
-0grub-core/kern/i386/xen/pvh.c line 3
Quoted 3 lines
grub-core/kern/i386/xen/pvh.c new file +3
-0@@ -0,0 +1,36 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2011 Free Software Foundation, Inc. Isn't this header (and the ones below) kind of off at least year wise?
Quoted 5 lines
Quoted 3 lines
Hmm, only a little bit :-)
Will update.
Please do this for all headers in the patchset
That was my plan :-)
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 08/18] xen: add basic hooks for PVH in current code
In reply to Daniel KiperQuoted 30 lines · Daniel Kiper
Quoted 29 lines · Juergen Gross
Quoted 27 lines · Roger Pau Monné
Quoted 20 lines · Juergen Gross
Add the hooks to current code needed for Xen PVH.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 36 +++++++++++++++++++++++++++++++++++ grub-core/kern/i386/xen/startup_pvh.S | 29 ++++++++++++++++++++++++++++ grub-core/kern/xen/init.c | 6 ++++++ include/grub/i386/xenpvh/kernel.h | 30 +++++++++++++++++++++++++++++ include/grub/xen.h | 6 ++++++ 5 files changed, 107 insertions(+) create mode 100644 grub-core/kern/i386/xen/pvh.c create mode 100644 grub-core/kern/i386/xen/startup_pvh.S create mode 100644 include/grub/i386/xenpvh/kernel.hgrub-core/kern/i386/xen/pvh.c new file +0
-0grub-core/kern/i386/xen/pvh.c line 3
Quoted 3 lines
grub-core/kern/i386/xen/pvh.c new file +3
-0@@ -0,0 +1,36 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2011 Free Software Foundation, Inc. Isn't this header (and the ones below) kind of off at least year wise?
Quoted 5 lines
Quoted 3 lines
Hmm, only a little bit :-)
Will update.
Please do this for all headers in the patchset
That was my plan :-)
Juergen
Juergen Gross
maintainerPATCH v2 9/18 xen: add PVH boot entry code
In reply to Juergen GrossAdd the code for the Xen PVH mode boot entry.
--- grub-core/kern/i386/xen/startup_pvh.S | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
grub-core/kern/i386/xen/startup_pvh.S +50 -0
@@ -19,11 +19,61 @@ #include <config.h> #include <grub/symbol.h> +#include <grub/machine/memory.h> .file "startup_pvh.S" .text + .globl start, _start + .code32 +start: +_start: + cld + lgdt gdtdesc + ljmp $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $1f +1: + movl $GRUB_MEMORY_MACHINE_PROT_MODE_DSEG, %eax + mov %eax, %ds + mov %eax, %es + mov %eax, %ss + leal LOCAL(stack_end), %esp + + /* Save address of start info structure. */ + mov %ebx, pvh_start_info + call EXT_C(grub_main) + /* Doesn't return. */ + + .p2align 3 +gdt: + .word 0, 0 + .byte 0, 0, 0, 0 + + /* -- code segment -- + * base = 0x00000000, limit = 0xFFFFF (4 KiB Granularity), present + * type = 32bit code execute/read, DPL = 0 + */ + .word 0xFFFF, 0 + .byte 0, 0x9A, 0xCF, 0 + + /* -- data segment -- + * base = 0x00000000, limit 0xFFFFF (4 KiB Granularity), present + * type = 32 bit data read/write, DPL = 0 + */ + .word 0xFFFF, 0 + .byte 0, 0x92, 0xCF, 0 + + .p2align 3 +/* this is the GDT descriptor */ +gdtdesc: + .word 0x17 /* limit */ + .long gdt /* addr */ + + .p2align 2 /* Saved pointer to start info structure. */ .globl pvh_start_info pvh_start_info: .long 0 + + .bss + .space (1 << 22) +LOCAL(stack_end):
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 09/18] xen: add PVH boot entry code
Quoted 22 lines · Juergen Gross
Add the code for the Xen PVH mode boot entry.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/startup_pvh.S | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)grub-core/kern/i386/xen/startup_pvh.S +3
-0@@ -19,11 +19,61 @@ #include <config.h> #include <grub/symbol.h> +#include <grub/machine/memory.h> .file "startup_pvh.S" .text + .globl start, _start + .code32
grub-core/kern/i386/xen/startup_pvh.S line 38
Quoted 10 lines
grub-core/kern/i386/xen/startup_pvh.S +10
-0+start: +_start: + cld + lgdt gdtdesc + ljmp $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $1f +1: + movl $GRUB_MEMORY_MACHINE_PROT_MODE_DSEG, %eax + mov %eax, %ds + mov %eax, %es + mov %eax, %ss
Should not you load null descriptor into %fs and %gs? Just in case...
Quoted 30 lines
grub-core/kern/i386/xen/startup_pvh.S +30
-0+ leal LOCAL(stack_end), %esp + + /* Save address of start info structure. */ + mov %ebx, pvh_start_info + call EXT_C(grub_main) + /* Doesn't return. */ + + .p2align 3 +gdt: + .word 0, 0 + .byte 0, 0, 0, 0 + + /* -- code segment -- + * base = 0x00000000, limit = 0xFFFFF (4 KiB Granularity), present + * type = 32bit code execute/read, DPL = 0 + */ + .word 0xFFFF, 0 + .byte 0, 0x9A, 0xCF, 0 + + /* -- data segment -- + * base = 0x00000000, limit 0xFFFFF (4 KiB Granularity), present + * type = 32 bit data read/write, DPL = 0 + */ + .word 0xFFFF, 0 + .byte 0, 0x92, 0xCF, 0 + + .p2align 3 +/* this is the GDT descriptor */ +gdtdesc: + .word 0x17 /* limit */
grub-core/kern/i386/xen/startup_pvh.S line 78
Quoted 10 lines
grub-core/kern/i386/xen/startup_pvh.S +6
-0+ .long gdt /* addr */ + + .p2align 2 /* Saved pointer to start info structure. */ .globl pvh_start_info pvh_start_info: .long 0 + + .bss + .space (1 << 22)
Hmmm... Why do we need 4 MiB here? If this is really needed then it begs for a comment. And I would like to see a constant instead of plain number here.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [PATCH v2 09/18] xen: add PVH boot entry code
Quoted 23 lines · Daniel Kiper
Quoted 22 lines · Juergen Gross
Add the code for the Xen PVH mode boot entry.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/startup_pvh.S | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)grub-core/kern/i386/xen/startup_pvh.S +3
-0@@ -19,11 +19,61 @@ #include <config.h> #include <grub/symbol.h> +#include <grub/machine/memory.h> .file "startup_pvh.S" .text + .globl start, _start + .code32
Quoted 13 lines
grub-core/kern/i386/xen/startup_pvh.S line 38
Quoted 10 lines
grub-core/kern/i386/xen/startup_pvh.S +10
-0+start: +_start: + cld + lgdt gdtdesc + ljmp $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $1f +1: + movl $GRUB_MEMORY_MACHINE_PROT_MODE_DSEG, %eax + mov %eax, %ds + mov %eax, %es + mov %eax, %ssShould not you load null descriptor into %fs and %gs? Just in case...
Hmm, if you want I can do that, sure.
Quoted 36 lines
Quoted 36 lines
grub-core/kern/i386/xen/startup_pvh.S +33
-0+ leal LOCAL(stack_end), %esp + + /* Save address of start info structure. */ + mov %ebx, pvh_start_info + call EXT_C(grub_main) + /* Doesn't return. */ + + .p2align 3 +gdt: + .word 0, 0 + .byte 0, 0, 0, 0 + + /* -- code segment -- + * base = 0x00000000, limit = 0xFFFFF (4 KiB Granularity), present + * type = 32bit code execute/read, DPL = 0 + */ + .word 0xFFFF, 0 + .byte 0, 0x9A, 0xCF, 0 + + /* -- data segment -- + * base = 0x00000000, limit 0xFFFFF (4 KiB Granularity), present + * type = 32 bit data read/write, DPL = 0 + */ + .word 0xFFFF, 0 + .byte 0, 0x92, 0xCF, 0 + + .p2align 3 +/* this is the GDT descriptor */ +gdtdesc: + .word 0x17 /* limit */ + .long gdt /* addr */ + + .p2align 2 /* Saved pointer to start info structure. */ .globl pvh_start_info
Quoted 8 lines
grub-core/kern/i386/xen/startup_pvh.S line 78
Quoted 5 lines
grub-core/kern/i386/xen/startup_pvh.S +3
-0pvh_start_info: .long 0 + + .bss + .space (1 << 22)Hmmm... Why do we need 4 MiB here? If this is really needed then it begs for a comment. And I would like to see a constant instead of plain number here.
This is just copied from xen/startup.S
I can reduce it to something near GRUB_MEMORY_MACHINE_PROT_STACK_SIZE (about 64kB).
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 09/18] xen: add PVH boot entry code
In reply to Daniel KiperQuoted 23 lines · Daniel Kiper
Quoted 22 lines · Juergen Gross
Add the code for the Xen PVH mode boot entry.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/startup_pvh.S | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)grub-core/kern/i386/xen/startup_pvh.S +3
-0@@ -19,11 +19,61 @@ #include <config.h> #include <grub/symbol.h> +#include <grub/machine/memory.h> .file "startup_pvh.S" .text + .globl start, _start + .code32
Quoted 13 lines
grub-core/kern/i386/xen/startup_pvh.S line 38
Quoted 10 lines
grub-core/kern/i386/xen/startup_pvh.S +10
-0+start: +_start: + cld + lgdt gdtdesc + ljmp $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $1f +1: + movl $GRUB_MEMORY_MACHINE_PROT_MODE_DSEG, %eax + mov %eax, %ds + mov %eax, %es + mov %eax, %ssShould not you load null descriptor into %fs and %gs? Just in case...
Hmm, if you want I can do that, sure.
Quoted 36 lines
Quoted 36 lines
grub-core/kern/i386/xen/startup_pvh.S +33
-0+ leal LOCAL(stack_end), %esp + + /* Save address of start info structure. */ + mov %ebx, pvh_start_info + call EXT_C(grub_main) + /* Doesn't return. */ + + .p2align 3 +gdt: + .word 0, 0 + .byte 0, 0, 0, 0 + + /* -- code segment -- + * base = 0x00000000, limit = 0xFFFFF (4 KiB Granularity), present + * type = 32bit code execute/read, DPL = 0 + */ + .word 0xFFFF, 0 + .byte 0, 0x9A, 0xCF, 0 + + /* -- data segment -- + * base = 0x00000000, limit 0xFFFFF (4 KiB Granularity), present + * type = 32 bit data read/write, DPL = 0 + */ + .word 0xFFFF, 0 + .byte 0, 0x92, 0xCF, 0 + + .p2align 3 +/* this is the GDT descriptor */ +gdtdesc: + .word 0x17 /* limit */ + .long gdt /* addr */ + + .p2align 2 /* Saved pointer to start info structure. */ .globl pvh_start_info
Quoted 8 lines
grub-core/kern/i386/xen/startup_pvh.S line 78
Quoted 5 lines
grub-core/kern/i386/xen/startup_pvh.S +3
-0pvh_start_info: .long 0 + + .bss + .space (1 << 22)Hmmm... Why do we need 4 MiB here? If this is really needed then it begs for a comment. And I would like to see a constant instead of plain number here.
This is just copied from xen/startup.S
I can reduce it to something near GRUB_MEMORY_MACHINE_PROT_STACK_SIZE (about 64kB).
Juergen
Re: [PATCH v2 09/18] xen: add PVH boot entry code
Quoted 38 lines · Juergen Gross
Quoted 23 lines · Daniel Kiper
Quoted 22 lines · Juergen Gross
Add the code for the Xen PVH mode boot entry.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/startup_pvh.S | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)grub-core/kern/i386/xen/startup_pvh.S +3
-0@@ -19,11 +19,61 @@ #include <config.h> #include <grub/symbol.h> +#include <grub/machine/memory.h> .file "startup_pvh.S" .text + .globl start, _start + .code32Quoted 13 lines
grub-core/kern/i386/xen/startup_pvh.S line 38
Quoted 10 lines
grub-core/kern/i386/xen/startup_pvh.S +10
-0+start: +_start: + cld + lgdt gdtdesc + ljmp $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $1f +1: + movl $GRUB_MEMORY_MACHINE_PROT_MODE_DSEG, %eax + mov %eax, %ds + mov %eax, %es + mov %eax, %ssShould not you load null descriptor into %fs and %gs? Just in case...
Quoted 1 line
Hmm, if you want I can do that, sure.
Please do.
Quoted 44 lines
Quoted 35 lines
Quoted 35 lines
grub-core/kern/i386/xen/startup_pvh.S +33
-0+ leal LOCAL(stack_end), %esp + + /* Save address of start info structure. */ + mov %ebx, pvh_start_info + call EXT_C(grub_main) + /* Doesn't return. */ + + .p2align 3 +gdt: + .word 0, 0 + .byte 0, 0, 0, 0 + + /* -- code segment -- + * base = 0x00000000, limit = 0xFFFFF (4 KiB Granularity), present + * type = 32bit code execute/read, DPL = 0 + */ + .word 0xFFFF, 0 + .byte 0, 0x9A, 0xCF, 0 + + /* -- data segment -- + * base = 0x00000000, limit 0xFFFFF (4 KiB Granularity), present + * type = 32 bit data read/write, DPL = 0 + */ + .word 0xFFFF, 0 + .byte 0, 0x92, 0xCF, 0 + + .p2align 3 +/* this is the GDT descriptor */ +gdtdesc: + .word 0x17 /* limit */ + .long gdt /* addr */ + + .p2align 2 /* Saved pointer to start info structure. */ .globl pvh_start_infoQuoted 8 lines
grub-core/kern/i386/xen/startup_pvh.S line 78
Quoted 5 lines
grub-core/kern/i386/xen/startup_pvh.S +3
-0pvh_start_info: .long 0 + + .bss + .space (1 << 22)Hmmm... Why do we need 4 MiB here? If this is really needed then it begs for a comment. And I would like to see a constant instead of plain number here.
Quoted 4 lines
This is just copied from
xen/startup.SI can reduce it to something near
GRUB_MEMORY_MACHINE_PROT_STACK_SIZE(about 64kB).
GRUB_MEMORY_MACHINE_PROT_STACK_SIZE works for me.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 09/18] xen: add PVH boot entry code
In reply to Juergen GrossQuoted 38 lines · Juergen Gross
Quoted 23 lines · Daniel Kiper
Quoted 22 lines · Juergen Gross
Add the code for the Xen PVH mode boot entry.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/startup_pvh.S | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)grub-core/kern/i386/xen/startup_pvh.S +3
-0@@ -19,11 +19,61 @@ #include <config.h> #include <grub/symbol.h> +#include <grub/machine/memory.h> .file "startup_pvh.S" .text + .globl start, _start + .code32Quoted 13 lines
grub-core/kern/i386/xen/startup_pvh.S line 38
Quoted 10 lines
grub-core/kern/i386/xen/startup_pvh.S +10
-0+start: +_start: + cld + lgdt gdtdesc + ljmp $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $1f +1: + movl $GRUB_MEMORY_MACHINE_PROT_MODE_DSEG, %eax + mov %eax, %ds + mov %eax, %es + mov %eax, %ssShould not you load null descriptor into %fs and %gs? Just in case...
Quoted 1 line
Hmm, if you want I can do that, sure.
Please do.
Quoted 44 lines
Quoted 35 lines
Quoted 35 lines
grub-core/kern/i386/xen/startup_pvh.S +33
-0+ leal LOCAL(stack_end), %esp + + /* Save address of start info structure. */ + mov %ebx, pvh_start_info + call EXT_C(grub_main) + /* Doesn't return. */ + + .p2align 3 +gdt: + .word 0, 0 + .byte 0, 0, 0, 0 + + /* -- code segment -- + * base = 0x00000000, limit = 0xFFFFF (4 KiB Granularity), present + * type = 32bit code execute/read, DPL = 0 + */ + .word 0xFFFF, 0 + .byte 0, 0x9A, 0xCF, 0 + + /* -- data segment -- + * base = 0x00000000, limit 0xFFFFF (4 KiB Granularity), present + * type = 32 bit data read/write, DPL = 0 + */ + .word 0xFFFF, 0 + .byte 0, 0x92, 0xCF, 0 + + .p2align 3 +/* this is the GDT descriptor */ +gdtdesc: + .word 0x17 /* limit */ + .long gdt /* addr */ + + .p2align 2 /* Saved pointer to start info structure. */ .globl pvh_start_infoQuoted 8 lines
grub-core/kern/i386/xen/startup_pvh.S line 78
Quoted 5 lines
grub-core/kern/i386/xen/startup_pvh.S +3
-0pvh_start_info: .long 0 + + .bss + .space (1 << 22)Hmmm... Why do we need 4 MiB here? If this is really needed then it begs for a comment. And I would like to see a constant instead of plain number here.
Quoted 4 lines
This is just copied from
xen/startup.SI can reduce it to something near
GRUB_MEMORY_MACHINE_PROT_STACK_SIZE(about 64kB).
GRUB_MEMORY_MACHINE_PROT_STACK_SIZE works for me.
Daniel
Juergen Gross
maintainerPATCH v2 10/18 xen: setup hypercall page for PVH
In reply to Juergen GrossAdd the needed code to setup the hypercall page for calling into the Xen hypervisor.
--- grub-core/kern/i386/xen/pvh.c | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
grub-core/kern/i386/xen/pvh.c +70 -0
@@ -20,14 +20,84 @@#include <grub/misc.h> #include <grub/memory.h> #include <grub/mm.h> +#include <grub/i386/cpuid.h> #include <grub/xen.h> #include <grub/machine/kernel.h> grub_uint64_t grub_rsdp_addr; +static struct { char _entry[32]; } hypercall_page[128] + __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE))); + +static grub_uint32_t xen_cpuid_base; + +static void +grub_xen_early_halt (void ) +{ + asmvolatile ("hlt" ); +} + +static void +grub_xen_cpuid_base (void ) +{ +grub_uint32_t base, eax, signature[3 ]; + +for (base =0x40000000 ; base <0x40010000 ; base +=0x100 ) + { +grub_cpuid (base, eax, signature[0 ], signature[1 ], signature[2 ]); +if (!grub_memcmp ("XenVMMXenVMM" , signature,12 ) && (eax - base) >=2 ) + { + xen_cpuid_base = base; +return ; + } + } + +grub_xen_early_halt (); +} + +static void +grub_xen_setup_hypercall_page (void ) +{ +grub_uint32_t msr, pfn, eax, ebx, ecx, edx; + +grub_cpuid (xen_cpuid_base +2 , eax, ebx, ecx, edx); + msr = ebx; + pfn = (grub_uint32_t) (&hypercall_page[0 ]); + + asmvolatile ("wrmsr" : :"c" (msr),"a" (pfn),"d" (0 ) :"memory" ); +} + +int +grub_xen_hypercall (grub_uint32_t callno,grub_uint32_t a0, +grub_uint32_t a1,grub_uint32_t a2, +grub_uint32_t a3,grub_uint32_t a4, +grub_uint32_t a5 __attribute__ ((unused))) +{ + registerunsigned long __res asm("eax" ); + register unsigned long __arg0 asm("ebx") = __arg0; + register unsigned long __arg1 asm("ecx") = __arg1; + register unsigned long __arg2 asm("edx") = __arg2; + register unsigned long __arg3 asm("esi") = __arg3; + register unsigned long __arg4 asm("edi") = __arg4; + + __arg0 = a0; + __arg1 = a1; + __arg2 = a2; + __arg3 = a3; + __arg4 = a4; + asmvolatile ("call *%[callno]" + :"=r" (__res),"+r" (__arg0),"+r" (__arg1),"+r" (__arg2), +"+r" (__arg3),"+r" (__arg4) + : [callno]"a" (&hypercall_page[callno]) + :"memory" ); +return __res; +} +void grub_xen_setup_pvh (void ) { +grub_xen_cpuid_base (); +grub_xen_setup_hypercall_page (); } grub_err_t
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 10/18] xen: setup hypercall page for PVH
Quoted 65 lines · Juergen Gross
Add the needed code to setup the hypercall page for calling into the Xen hypervisor.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)grub-core/kern/i386/xen/pvh.c +44
-0@@ -20,14 +20,84 @@#include <grub/misc.h> #include <grub/memory.h> #include <grub/mm.h> +#include <grub/i386/cpuid.h> #include <grub/xen.h> #include <grub/machine/kernel.h> grub_uint64_t grub_rsdp_addr; +static struct { char _entry[32]; } hypercall_page[128] + __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE))); + +static grub_uint32_t xen_cpuid_base; + +static void +grub_xen_early_halt (void ) +{ + asmvolatile ("hlt" ); +} + +static void +grub_xen_cpuid_base (void ) +{ +grub_uint32_t base, eax, signature[3 ]; + +for (base =0x40000000 ; base <0x40010000 ; base +=0x100 ) + { +grub_cpuid (base, eax, signature[0 ], signature[1 ], signature[2 ]); +if (!grub_memcmp ("XenVMMXenVMM" , signature,12 ) && (eax - base) >=2 ) + { + xen_cpuid_base = base; +return ; + } + } + +grub_xen_early_halt (); +} + +static void +grub_xen_setup_hypercall_page (void ) +{ +grub_uint32_t msr, pfn, eax, ebx, ecx, edx; + +grub_cpuid (xen_cpuid_base +2 , eax, ebx, ecx, edx); + msr = ebx; + pfn = (grub_uint32_t) (&hypercall_page[0 ]); + + asmvolatile ("wrmsr" : :"c" (msr),"a" (pfn),"d" (0 ) :"memory" ); +} + +int +grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,
grub-core/kern/i386/xen/pvh.c line 81
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+ grub_uint32_t a1, grub_uint32_t a2, + grub_uint32_t a3, grub_uint32_t a4, + grub_uint32_t a5 __attribute__ ((unused))) +{ + register unsigned long __res asm("eax"); + register unsigned long __arg0 asm("ebx") = __arg0; + register unsigned long __arg1 asm("ecx") = __arg1; + register unsigned long __arg2 asm("edx") = __arg2; + register unsigned long __arg3 asm("esi") = __arg3; + register unsigned long __arg4 asm("edi") = __arg4;
Why do we need this play with registers. Does not asm below work with "a", "b", ... like above?
grub-core/kern/i386/xen/pvh.c line 92
Quoted 11 lines
grub-core/kern/i386/xen/pvh.c +11
-0+ + __arg0 = a0; + __arg1 = a1; + __arg2 = a2; + __arg3 = a3; + __arg4 = a4; + asmvolatile ("call *%[callno]" + :"=r" (__res),"+r" (__arg0),"+r" (__arg1),"+r" (__arg2), +"+r" (__arg3),"+r" (__arg4) + : [callno]"a" (&hypercall_page[callno]) + :"memory" );
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 10/18] xen: setup hypercall page for PVH
Quoted 12 lines · Daniel Kiper
grub-core/kern/i386/xen/pvh.c line 92
Quoted 11 lines · Juergen Gross
grub-core/kern/i386/xen/pvh.c +11
-0+ + __arg0 = a0; + __arg1 = a1; + __arg2 = a2; + __arg3 = a3; + __arg4 = a4; + asmvolatile ("call *%[callno]" + :"=r" (__res),"+r" (__arg0),"+r" (__arg1),"+r" (__arg2), +"+r" (__arg3),"+r" (__arg4) + : [callno]"a" (&hypercall_page[callno]) + :"memory" );
call hypercall_page + %c[offset]
passing [offset] "i" (callno * 32)
which gives you a direct call, rather than an indirect one.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 10/18] xen: setup hypercall page for PVH
In reply to Daniel KiperQuoted 12 lines · Daniel Kiper
grub-core/kern/i386/xen/pvh.c line 92
Quoted 11 lines · Juergen Gross
grub-core/kern/i386/xen/pvh.c +11
-0+ + __arg0 = a0; + __arg1 = a1; + __arg2 = a2; + __arg3 = a3; + __arg4 = a4; + asmvolatile ("call *%[callno]" + :"=r" (__res),"+r" (__arg0),"+r" (__arg1),"+r" (__arg2), +"+r" (__arg3),"+r" (__arg4) + : [callno]"a" (&hypercall_page[callno]) + :"memory" );
call hypercall_page + %c[offset]
passing [offset] "i" (callno * 32)
which gives you a direct call, rather than an indirect one.
~Andrew
Juergen Gross
maintainerRe: [PATCH v2 10/18] xen: setup hypercall page for PVH
In reply to Daniel KiperQuoted 71 lines · Daniel Kiper
Quoted 70 lines · Juergen Gross
Add the needed code to setup the hypercall page for calling into the Xen hypervisor.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)grub-core/kern/i386/xen/pvh.c +49
-0@@ -20,14 +20,84 @@#include <grub/misc.h> #include <grub/memory.h> #include <grub/mm.h> +#include <grub/i386/cpuid.h> #include <grub/xen.h> #include <grub/machine/kernel.h> grub_uint64_t grub_rsdp_addr; +static struct { char _entry[32]; } hypercall_page[128] + __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE))); + +static grub_uint32_t xen_cpuid_base; + +static void +grub_xen_early_halt (void ) +{ + asmvolatile ("hlt" ); +} + +static void +grub_xen_cpuid_base (void ) +{ +grub_uint32_t base, eax, signature[3 ]; + +for (base =0x40000000 ; base <0x40010000 ; base +=0x100 ) + { +grub_cpuid (base, eax, signature[0 ], signature[1 ], signature[2 ]); +if (!grub_memcmp ("XenVMMXenVMM" , signature,12 ) && (eax - base) >=2 ) + { + xen_cpuid_base = base; +return ; + } + } + +grub_xen_early_halt (); +} + +static void +grub_xen_setup_hypercall_page (void ) +{ +grub_uint32_t msr, pfn, eax, ebx, ecx, edx; + +grub_cpuid (xen_cpuid_base +2 , eax, ebx, ecx, edx); + msr = ebx; + pfn = (grub_uint32_t) (&hypercall_page[0 ]); + + asmvolatile ("wrmsr" : :"c" (msr),"a" (pfn),"d" (0 ) :"memory" ); +} + +int +grub_xen_hypercall (grub_uint32_t callno,grub_uint32_t a0, +grub_uint32_t a1,grub_uint32_t a2, +grub_uint32_t a3,grub_uint32_t a4, +grub_uint32_t a5 __attribute__ ((unused))) +{ + registerunsigned long __res asm("eax" );
Quoted 8 lines
grub-core/kern/i386/xen/pvh.c line 81
Quoted 5 lines
grub-core/kern/i386/xen/pvh.c +5
-0+ register unsigned long __arg0 asm("ebx") = __arg0; + register unsigned long __arg1 asm("ecx") = __arg1; + register unsigned long __arg2 asm("edx") = __arg2; + register unsigned long __arg3 asm("esi") = __arg3; + register unsigned long __arg4 asm("edi") = __arg4;Why do we need this play with registers. Does not asm below work with "a", "b", ... like above?
Probably, yes. This was inspired by Linux 32-bit version.
I can use the mini-os variant which combines Andrew's suggestion and yours.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 10/18] xen: setup hypercall page for PVH
In reply to Daniel KiperQuoted 71 lines · Daniel Kiper
Quoted 70 lines · Juergen Gross
Add the needed code to setup the hypercall page for calling into the Xen hypervisor.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)grub-core/kern/i386/xen/pvh.c +49
-0@@ -20,14 +20,84 @@#include <grub/misc.h> #include <grub/memory.h> #include <grub/mm.h> +#include <grub/i386/cpuid.h> #include <grub/xen.h> #include <grub/machine/kernel.h> grub_uint64_t grub_rsdp_addr; +static struct { char _entry[32]; } hypercall_page[128] + __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE))); + +static grub_uint32_t xen_cpuid_base; + +static void +grub_xen_early_halt (void ) +{ + asmvolatile ("hlt" ); +} + +static void +grub_xen_cpuid_base (void ) +{ +grub_uint32_t base, eax, signature[3 ]; + +for (base =0x40000000 ; base <0x40010000 ; base +=0x100 ) + { +grub_cpuid (base, eax, signature[0 ], signature[1 ], signature[2 ]); +if (!grub_memcmp ("XenVMMXenVMM" , signature,12 ) && (eax - base) >=2 ) + { + xen_cpuid_base = base; +return ; + } + } + +grub_xen_early_halt (); +} + +static void +grub_xen_setup_hypercall_page (void ) +{ +grub_uint32_t msr, pfn, eax, ebx, ecx, edx; + +grub_cpuid (xen_cpuid_base +2 , eax, ebx, ecx, edx); + msr = ebx; + pfn = (grub_uint32_t) (&hypercall_page[0 ]); + + asmvolatile ("wrmsr" : :"c" (msr),"a" (pfn),"d" (0 ) :"memory" ); +} + +int +grub_xen_hypercall (grub_uint32_t callno,grub_uint32_t a0, +grub_uint32_t a1,grub_uint32_t a2, +grub_uint32_t a3,grub_uint32_t a4, +grub_uint32_t a5 __attribute__ ((unused))) +{ + registerunsigned long __res asm("eax" );
Quoted 8 lines
grub-core/kern/i386/xen/pvh.c line 81
Quoted 5 lines
grub-core/kern/i386/xen/pvh.c +5
-0+ register unsigned long __arg0 asm("ebx") = __arg0; + register unsigned long __arg1 asm("ecx") = __arg1; + register unsigned long __arg2 asm("edx") = __arg2; + register unsigned long __arg3 asm("esi") = __arg3; + register unsigned long __arg4 asm("edi") = __arg4;Why do we need this play with registers. Does not asm below work with "a", "b", ... like above?
Probably, yes. This was inspired by Linux 32-bit version.
I can use the mini-os variant which combines Andrew's suggestion and yours.
Juergen
Re: [PATCH v2 10/18] xen: setup hypercall page for PVH
In reply to Juergen GrossQuoted 19 lines · Juergen Gross
Add the needed code to setup the hypercall page for calling into the Xen hypervisor.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)grub-core/kern/i386/xen/pvh.c +1
-0@@ -20,14 +20,84 @@#include <grub/misc.h> #include <grub/memory.h> #include <grub/mm.h> +#include <grub/i386/cpuid.h> #include <grub/xen.h> #include <grub/machine/kernel.h>
grub-core/kern/i386/xen/pvh.c line 35
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +7
-0grub_uint64_t grub_rsdp_addr; +static struct { char _entry[32]; } hypercall_page[128] + __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE))); + +static grub_uint32_t xen_cpuid_base; + +static void +grub_xen_early_halt (void )
I would rename this to grub_xen_early_crash
grub-core/kern/i386/xen/pvh.c line 36
Quoted 1 line
grub-core/kern/i386/xen/pvh.c +1
-0+{
And you can use the 0xe9 IO port to print a crash debug message even before initializing the hypercall page, I think this would be helpful here.
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 10/18] xen: setup hypercall page for PVH
In reply to Juergen GrossQuoted 19 lines · Juergen Gross
Add the needed code to setup the hypercall page for calling into the Xen hypervisor.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)grub-core/kern/i386/xen/pvh.c +1
-0@@ -20,14 +20,84 @@#include <grub/misc.h> #include <grub/memory.h> #include <grub/mm.h> +#include <grub/i386/cpuid.h> #include <grub/xen.h> #include <grub/machine/kernel.h>
grub-core/kern/i386/xen/pvh.c line 35
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +7
-0grub_uint64_t grub_rsdp_addr; +static struct { char _entry[32]; } hypercall_page[128] + __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE))); + +static grub_uint32_t xen_cpuid_base; + +static void +grub_xen_early_halt (void )
I would rename this to grub_xen_early_crash
grub-core/kern/i386/xen/pvh.c line 36
Quoted 1 line
grub-core/kern/i386/xen/pvh.c +1
-0+{
And you can use the 0xe9 IO port to print a crash debug message even before initializing the hypercall page, I think this would be helpful here.
Roger.
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 10/18] xen: setup hypercall page for PVH
Quoted 33 lines · Roger Pau Monné
Quoted 19 lines · Juergen Gross
Add the needed code to setup the hypercall page for calling into the Xen hypervisor.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)grub-core/kern/i386/xen/pvh.c +1
-0@@ -20,14 +20,84 @@#include <grub/misc.h> #include <grub/memory.h> #include <grub/mm.h> +#include <grub/i386/cpuid.h> #include <grub/xen.h> #include <grub/machine/kernel.h> grub-core/kern/i386/xen/pvh.c line 35
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +7
-0grub_uint64_t grub_rsdp_addr; +static struct { char _entry[32]; } hypercall_page[128] + __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE))); + +static grub_uint32_t xen_cpuid_base; + +static void +grub_xen_early_halt (void )I would rename this to
grub_xen_early_crash
Quoted 5 lines
grub-core/kern/i386/xen/pvh.c line 36
Quoted 1 line
grub-core/kern/i386/xen/pvh.c +1
-0+{And you can use the
0xe9IO port to print a crash debug message even before initializing the hypercall page, I think this would be helpful here.
Aah, I didn't know that.
Thanks, I'll change grub_xen_early_halt() to grub_xen_panic() taking a string as parameter.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v2 11/18 xen: get memory map from hypervisor for PVH
In reply to Juergen GrossRetrieve the memory map from the hypervisor and normalize it to contain no overlapping entries and to be sorted by address.
--- grub-core/kern/i386/xen/pvh.c | 98 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)
grub-core/kern/i386/xen/pvh.c +98 -0
@@ -22,7 +22,16 @@#include <grub/mm.h> #include <grub/i386/cpuid.h> #include <grub/xen.h> +#include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/memory.h> + +struct xen_machine_mmap_entry +{ +grub_uint64_t addr; +grub_uint64_t len; +grub_uint32_t type; +}GRUB_PACKED ;grub_uint64_t grub_rsdp_addr;
@@ -30,6 +39,8 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct xen_machine_mmap_entry map[128 ]; +static unsigned int nr_map_entries;static void grub_xen_early_halt (void )
@@ -93,11 +104,98 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static void +grub_xen_sort_mmap (void ) +{ +grub_uint64_t from, to; +unsigned int i; +struct xen_machine_mmap_entry tmp; + +/* Align map entries to page boundaries. */ +for (i =0 ; i < nr_map_entries; i++) + { + from = map[i].addr; + to = from + map[i].len; +if (map[i].type ==GRUB_MEMORY_AVAILABLE ) + { + from =ALIGN_UP (from,GRUB_XEN_PAGE_SIZE ); + to =ALIGN_DOWN (to,GRUB_XEN_PAGE_SIZE ); + } +else + { + from =ALIGN_DOWN (from,GRUB_XEN_PAGE_SIZE ); + to =ALIGN_UP (to,GRUB_XEN_PAGE_SIZE ); + } + map[i].addr = from; + map[i].len = to - from; + } + + again: +/* Sort entries by start address. */ +for (i =1 ; i < nr_map_entries; i++) + { +if (map[i].addr >= map[i -1 ].addr) +continue ; + tmp = map[i]; + map[i] = map[i -1 ]; + map[i -1 ] = tmp; + i =0 ; + } + +/* Detect overlapping areas. */ +for (i =1 ; i < nr_map_entries; i++) + { +if (map[i].addr >= map[i -1 ].addr + map[i -1 ].len) +continue ; + tmp = map[i -1 ]; + map[i -1 ].len = map[i].addr - map[i -1 ].addr; +if (map[i].addr + map[i].len >= tmp.addr + tmp.len) +continue ; +if (nr_map_entries <ARRAY_SIZE (map)) + { + map[nr_map_entries].addr = map[i].addr + map[i].len; + map[nr_map_entries].len = tmp.addr + tmp.len - map[nr_map_entries].addr; + map[nr_map_entries].type = tmp.type; + nr_map_entries++; + goto again; + } + } + +/* Merge adjacent entries. */ +for (i =1 ; i < nr_map_entries; i++) + { +if (map[i].type == map[i -1 ].type && + map[i].addr == map[i -1 ].addr + map[i -1 ].len) + { + map[i -1 ].len += map[i].len; + map[i] = map[nr_map_entries -1 ]; + nr_map_entries--; + goto again; + } + } +} + +static void +grub_xen_get_mmap (void ) +{ +struct xen_memory_map memmap; + + memmap.nr_entries =ARRAY_SIZE (map); +set_xen_guest_handle (memmap.buffer, map); +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_memory_map, + (grub_uint32_t) (&memmap),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); + nr_map_entries = memmap.nr_entries; + +grub_xen_sort_mmap (); +} +void grub_xen_setup_pvh (void ) {grub_xen_cpuid_base ();grub_xen_setup_hypercall_page (); +grub_xen_get_mmap (); } grub_err_t
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 11/18] xen: get memory map from hypervisor for PVH
Quoted 16 lines · Juergen Gross
Retrieve the memory map from the hypervisor and normalize it to contain no overlapping entries and to be sorted by address.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 98 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)grub-core/kern/i386/xen/pvh.c +0
-0@@ -22,7 +22,16 @@#include <grub/mm.h> #include <grub/i386/cpuid.h> #include <grub/xen.h>
grub-core/kern/i386/xen/pvh.c line 34
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +9
-0+#include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/memory.h> + +struct xen_machine_mmap_entry +{ +grub_uint64_t addr; +grub_uint64_t len; +grub_uint32_t type; +}GRUB_PACKED ;
Could not we reuse grub_e820_mmap_entry here?
grub-core/kern/i386/xen/pvh.c static struct { char _entry[32]; } hypercall_page[128] · line 42
Quoted 7 lines
grub-core/kern/i386/xen/pvh.c +1
-0grub_uint64_t grub_rsdp_addr;@@ -30,6 +39,8 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct xen_machine_mmap_entry map[128 ];
A constant instead of 128? If no why 128?
Quoted 13 lines
grub-core/kern/i386/xen/pvh.c +6
-0+static unsigned int nr_map_entries;static void grub_xen_early_halt (void )@@ -93,11 +104,98 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static void +grub_xen_sort_mmap (void ) +{ +grub_uint64_t from, to; +unsigned int i;
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 121
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+struct xen_machine_mmap_entry tmp; + +/* Align map entries to page boundaries. */ +for (i =0 ; i < nr_map_entries; i++) + { + from = map[i].addr; + to = from + map[i].len; +if (map[i].type ==GRUB_MEMORY_AVAILABLE ) + { + from =ALIGN_UP (from,GRUB_XEN_PAGE_SIZE );
Lack of space between macro name and "(".
Here and below...
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 131
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+ to =ALIGN_DOWN (to,GRUB_XEN_PAGE_SIZE ); + } +else + { + from =ALIGN_DOWN (from,GRUB_XEN_PAGE_SIZE ); + to =ALIGN_UP (to,GRUB_XEN_PAGE_SIZE ); + } + map[i].addr = from; + map[i].len = to - from; + }
[...]
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 11/18] xen: get memory map from hypervisor for PVH
In reply to Juergen GrossQuoted 16 lines · Juergen Gross
Retrieve the memory map from the hypervisor and normalize it to contain no overlapping entries and to be sorted by address.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 98 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)grub-core/kern/i386/xen/pvh.c +0
-0@@ -22,7 +22,16 @@#include <grub/mm.h> #include <grub/i386/cpuid.h> #include <grub/xen.h>
grub-core/kern/i386/xen/pvh.c line 34
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +9
-0+#include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/memory.h> + +struct xen_machine_mmap_entry +{ +grub_uint64_t addr; +grub_uint64_t len; +grub_uint32_t type; +}GRUB_PACKED ;
Could not we reuse grub_e820_mmap_entry here?
grub-core/kern/i386/xen/pvh.c static struct { char _entry[32]; } hypercall_page[128] · line 42
Quoted 7 lines
grub-core/kern/i386/xen/pvh.c +1
-0grub_uint64_t grub_rsdp_addr;@@ -30,6 +39,8 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct xen_machine_mmap_entry map[128 ];
A constant instead of 128? If no why 128?
Quoted 13 lines
grub-core/kern/i386/xen/pvh.c +6
-0+static unsigned int nr_map_entries;static void grub_xen_early_halt (void )@@ -93,11 +104,98 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static void +grub_xen_sort_mmap (void ) +{ +grub_uint64_t from, to; +unsigned int i;
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 121
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+struct xen_machine_mmap_entry tmp; + +/* Align map entries to page boundaries. */ +for (i =0 ; i < nr_map_entries; i++) + { + from = map[i].addr; + to = from + map[i].len; +if (map[i].type ==GRUB_MEMORY_AVAILABLE ) + { + from =ALIGN_UP (from,GRUB_XEN_PAGE_SIZE );
Lack of space between macro name and "(".
Here and below...
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 131
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+ to =ALIGN_DOWN (to,GRUB_XEN_PAGE_SIZE ); + } +else + { + from =ALIGN_DOWN (from,GRUB_XEN_PAGE_SIZE ); + to =ALIGN_UP (to,GRUB_XEN_PAGE_SIZE ); + } + map[i].addr = from; + map[i].len = to - from; + }
[...]
Daniel
Juergen Gross
maintainerRe: [PATCH v2 11/18] xen: get memory map from hypervisor for PVH
Quoted 21 lines · Daniel Kiper
Quoted 20 lines · Juergen Gross
Retrieve the memory map from the hypervisor and normalize it to contain no overlapping entries and to be sorted by address.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 98 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)grub-core/kern/i386/xen/pvh.c +3
-0@@ -22,7 +22,16 @@#include <grub/mm.h> #include <grub/i386/cpuid.h> #include <grub/xen.h> +#include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/memory.h> +
Quoted 8 lines
grub-core/kern/i386/xen/pvh.c line 34
Quoted 6 lines
grub-core/kern/i386/xen/pvh.c +6
-0+struct xen_machine_mmap_entry +{ +grub_uint64_t addr; +grub_uint64_t len; +grub_uint32_t type; +}GRUB_PACKED ;Could not we reuse
grub_e820_mmap_entryhere?
This is defined only locally in grub-core/mmap/i386/pc/mmap.c
I can move it into an appropriate header and use it here and in mmap.c
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c static struct { char _entry[32]; } hypercall_page[128] · line 42
Quoted 8 lines
grub-core/kern/i386/xen/pvh.c +1
-0grub_uint64_t grub_rsdp_addr;@@ -30,6 +39,8 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct xen_machine_mmap_entry map[128 ];A constant instead of 128? If no why 128?
I can use a macro instead.
Quoted 19 lines
Quoted 19 lines
grub-core/kern/i386/xen/pvh.c +11
-0+static unsigned int nr_map_entries;static void grub_xen_early_halt (void )@@ -93,11 +104,98 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static void +grub_xen_sort_mmap (void ) +{ +grub_uint64_t from, to; +unsigned int i; +struct xen_machine_mmap_entry tmp; + +/* Align map entries to page boundaries. */ +for (i =0 ; i < nr_map_entries; i++) + {
Quoted 8 lines
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 121
Quoted 5 lines
grub-core/kern/i386/xen/pvh.c +5
-0+ from = map[i].addr; + to = from + map[i].len; +if (map[i].type ==GRUB_MEMORY_AVAILABLE ) + { + from =ALIGN_UP (from,GRUB_XEN_PAGE_SIZE );Lack of space between macro name and "(".
Here and below...
Okay.
Quoted 11 lines
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 131
Quoted 11 lines
grub-core/kern/i386/xen/pvh.c +10
-0+ to =ALIGN_DOWN (to,GRUB_XEN_PAGE_SIZE ); + } +else + { + from =ALIGN_DOWN (from,GRUB_XEN_PAGE_SIZE ); + to =ALIGN_UP (to,GRUB_XEN_PAGE_SIZE ); + } + map[i].addr = from; + map[i].len = to - from; + }
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 11/18] xen: get memory map from hypervisor for PVH
In reply to Daniel KiperQuoted 21 lines · Daniel Kiper
Quoted 20 lines · Juergen Gross
Retrieve the memory map from the hypervisor and normalize it to contain no overlapping entries and to be sorted by address.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 98 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)grub-core/kern/i386/xen/pvh.c +3
-0@@ -22,7 +22,16 @@#include <grub/mm.h> #include <grub/i386/cpuid.h> #include <grub/xen.h> +#include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/memory.h> +
Quoted 8 lines
grub-core/kern/i386/xen/pvh.c line 34
Quoted 6 lines
grub-core/kern/i386/xen/pvh.c +6
-0+struct xen_machine_mmap_entry +{ +grub_uint64_t addr; +grub_uint64_t len; +grub_uint32_t type; +}GRUB_PACKED ;Could not we reuse
grub_e820_mmap_entryhere?
This is defined only locally in grub-core/mmap/i386/pc/mmap.c
I can move it into an appropriate header and use it here and in mmap.c
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c static struct { char _entry[32]; } hypercall_page[128] · line 42
Quoted 8 lines
grub-core/kern/i386/xen/pvh.c +1
-0grub_uint64_t grub_rsdp_addr;@@ -30,6 +39,8 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct xen_machine_mmap_entry map[128 ];A constant instead of 128? If no why 128?
I can use a macro instead.
Quoted 19 lines
Quoted 19 lines
grub-core/kern/i386/xen/pvh.c +11
-0+static unsigned int nr_map_entries;static void grub_xen_early_halt (void )@@ -93,11 +104,98 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static void +grub_xen_sort_mmap (void ) +{ +grub_uint64_t from, to; +unsigned int i; +struct xen_machine_mmap_entry tmp; + +/* Align map entries to page boundaries. */ +for (i =0 ; i < nr_map_entries; i++) + {
Quoted 8 lines
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 121
Quoted 5 lines
grub-core/kern/i386/xen/pvh.c +5
-0+ from = map[i].addr; + to = from + map[i].len; +if (map[i].type ==GRUB_MEMORY_AVAILABLE ) + { + from =ALIGN_UP (from,GRUB_XEN_PAGE_SIZE );Lack of space between macro name and "(".
Here and below...
Okay.
Quoted 11 lines
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 131
Quoted 11 lines
grub-core/kern/i386/xen/pvh.c +10
-0+ to =ALIGN_DOWN (to,GRUB_XEN_PAGE_SIZE ); + } +else + { + from =ALIGN_DOWN (from,GRUB_XEN_PAGE_SIZE ); + to =ALIGN_UP (to,GRUB_XEN_PAGE_SIZE ); + } + map[i].addr = from; + map[i].len = to - from; + }
Juergen
Juergen Gross
maintainerPATCH v2 12/18 xen: setup Xen specific data for PVH
In reply to Juergen GrossInitialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info page
Set the RSDP address for the guest from the start_info page passed as boot parameter.
--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)
grub-core/kern/i386/xen/pvh.c +107 -0
@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry
@@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;
@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 ); +if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {
@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */ +for (i =0 ; i < nr_map_entries; i++) + { +if (last > map[i].addr + map[i].len) +continue ; +if (last < map[i].addr) +return last; +if ((map[i].addr >>32 ) || ((map[i].addr + map[i].len) >>32 )) +break ; + last = map[i].addr + map[i].len; + } +if (i == nr_map_entries) +return last; + +/* No hole found, use the highest RAM page below 4G and reserve it. */ +if (nr_map_entries ==ARRAY_SIZE (map)) +grub_xen_early_halt (); + j =0 ; +for (i =0 ; i < nr_map_entries; i++) + { +if (map[i].type !=GRUB_MEMORY_AVAILABLE ) +continue ; +if (map[i].addr >>32 ) +break ; + j = i; +if ((map[i].addr + map[i].len) >>32 ) +break ; + } +if (map[j].type !=GRUB_MEMORY_AVAILABLE ) +grub_xen_early_halt (); +if ((map[i].addr + map[i].len) >>32 ) + last = (1ULL <<32 ) -GRUB_XEN_PAGE_SIZE ; +else + last = map[i].addr + map[i].len -GRUB_XEN_PAGE_SIZE ; + map[nr_map_entries].addr = last; + map[nr_map_entries].len =GRUB_XEN_PAGE_SIZE ; + map[nr_map_entries].type =GRUB_MEMORY_RESERVED ; + nr_map_entries++; +grub_xen_sort_mmap (); + +return last; +} +void grub_xen_setup_pvh (void ) { +grub_addr_t par; +grub_xen_cpuid_base ();grub_xen_setup_hypercall_page ();grub_xen_get_mmap (); + +/* Setup Xen data. */ + grub_xen_start_page_addr = &grub_xen_start_page; + + par =grub_xen_get_param (HVM_PARAM_CONSOLE_PFN ); + grub_xen_start_page_addr->console.domU.mfn = par; + grub_xen_xcons = (void *) (grub_addr_t) (par <<GRUB_XEN_LOG_PAGE_SIZE ); + par =grub_xen_get_param (HVM_PARAM_CONSOLE_EVTCHN ); + grub_xen_start_page_addr->console.domU.evtchn = par; + + par =grub_xen_get_param (HVM_PARAM_STORE_PFN ); + grub_xen_start_page_addr->store_mfn = par; + grub_xen_xenstore = (void *) (grub_addr_t) (par <<GRUB_XEN_LOG_PAGE_SIZE ); + par =grub_xen_get_param (HVM_PARAM_STORE_EVTCHN ); + grub_xen_start_page_addr->store_evtchn = par; + + par =grub_xen_find_page (0 ); + grub_xen_grant_table =grub_xen_add_physmap (XENMAPSPACE_grant_table, + (void *) par); + par =grub_xen_find_page (par +GRUB_XEN_PAGE_SIZE ); + grub_xen_shared_info =grub_xen_add_physmap (XENMAPSPACE_shared_info, + (void *) par); + + grub_rsdp_addr = pvh_start_info->rsdp_paddr; } grub_err_t
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 12/18] xen: setup Xen specific data for PVH
Quoted 39 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +2
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; }
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 118
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 );
s/(grub_uint32_t) (&xhv)/(grub_uint32_t)(&xhv)/
Here and in the other patches...
Quoted 38 lines
grub-core/kern/i386/xen/pvh.c +31
-0+if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */ +for (i =0 ; i < nr_map_entries; i++) + { +if (last > map[i].addr + map[i].len) +continue ;
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 245
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+if (last < map[i].addr) +return last; +if ((map[i].addr >>32 ) || ((map[i].addr + map[i].len) >>32 )) +break ; + last = map[i].addr + map[i].len; + } +if (i == nr_map_entries) +return last; + +/* No hole found, use the highest RAM page below 4G and reserve it. */
It seems to me that this comment should be put before next for().
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 249
Quoted 4 lines
grub-core/kern/i386/xen/pvh.c +4
-0+if (nr_map_entries ==ARRAY_SIZE (map)) +grub_xen_early_halt (); + j =0 ; +for (i =0 ; i < nr_map_entries; i++)
for (i = 0, j = 0; i < nr_map_entries; i++)
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 12/18] xen: setup Xen specific data for PVH
In reply to Juergen GrossQuoted 39 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +2
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; }
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 118
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 );
s/(grub_uint32_t) (&xhv)/(grub_uint32_t)(&xhv)/
Here and in the other patches...
Quoted 38 lines
grub-core/kern/i386/xen/pvh.c +31
-0+if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */ +for (i =0 ; i < nr_map_entries; i++) + { +if (last > map[i].addr + map[i].len) +continue ;
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 245
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+if (last < map[i].addr) +return last; +if ((map[i].addr >>32 ) || ((map[i].addr + map[i].len) >>32 )) +break ; + last = map[i].addr + map[i].len; + } +if (i == nr_map_entries) +return last; + +/* No hole found, use the highest RAM page below 4G and reserve it. */
It seems to me that this comment should be put before next for().
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 249
Quoted 4 lines
grub-core/kern/i386/xen/pvh.c +4
-0+if (nr_map_entries ==ARRAY_SIZE (map)) +grub_xen_early_halt (); + j =0 ; +for (i =0 ; i < nr_map_entries; i++)
for (i = 0, j = 0; i < nr_map_entries; i++)
Daniel
Juergen Gross
maintainerRe: [PATCH v2 12/18] xen: setup Xen specific data for PVH
Quoted 40 lines · Daniel Kiper
Quoted 39 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +2
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; }
Quoted 13 lines
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 118
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 );s/(grub_uint32_t) (&xhv)/(grub_uint32_t)(&xhv)/
Here and in the other patches...
Oh, I have seen lots of places where casts are followed by a blank. I thought this would be the preferred style.
Quoted 43 lines
Quoted 43 lines
grub-core/kern/i386/xen/pvh.c +35
-0+if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */ +for (i =0 ; i < nr_map_entries; i++) + { +if (last > map[i].addr + map[i].len) +continue ; +if (last < map[i].addr) +return last; +if ((map[i].addr >>32 ) || ((map[i].addr + map[i].len) >>32 )) +break ;
Quoted 8 lines
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 245
Quoted 6 lines
grub-core/kern/i386/xen/pvh.c +6
-0+ last = map[i].addr + map[i].len; + } +if (i == nr_map_entries) +return last; + +/* No hole found, use the highest RAM page below 4G and reserve it. */ It seems to me that this comment should be put before next
for().
Hmm, that's a matter of taste, I think. The comment is at the point where the "no hole found" case is started to be handled. I can move it down, of course.
Quoted 7 lines
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 249
Quoted 5 lines
grub-core/kern/i386/xen/pvh.c +4
-0+if (nr_map_entries ==ARRAY_SIZE (map)) +grub_xen_early_halt (); + j =0 ; +for (i =0 ; i < nr_map_entries; i++)for (i = 0, j = 0; i <
nr_map_entries; i++)
Okay.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 12/18] xen: setup Xen specific data for PVH
In reply to Daniel KiperQuoted 40 lines · Daniel Kiper
Quoted 39 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +2
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; }
Quoted 13 lines
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 118
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 );s/(grub_uint32_t) (&xhv)/(grub_uint32_t)(&xhv)/
Here and in the other patches...
Oh, I have seen lots of places where casts are followed by a blank. I thought this would be the preferred style.
Quoted 43 lines
Quoted 43 lines
grub-core/kern/i386/xen/pvh.c +35
-0+if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */ +for (i =0 ; i < nr_map_entries; i++) + { +if (last > map[i].addr + map[i].len) +continue ; +if (last < map[i].addr) +return last; +if ((map[i].addr >>32 ) || ((map[i].addr + map[i].len) >>32 )) +break ;
Quoted 8 lines
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 245
Quoted 6 lines
grub-core/kern/i386/xen/pvh.c +6
-0+ last = map[i].addr + map[i].len; + } +if (i == nr_map_entries) +return last; + +/* No hole found, use the highest RAM page below 4G and reserve it. */ It seems to me that this comment should be put before next
for().
Hmm, that's a matter of taste, I think. The comment is at the point where the "no hole found" case is started to be handled. I can move it down, of course.
Quoted 7 lines
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 249
Quoted 5 lines
grub-core/kern/i386/xen/pvh.c +4
-0+if (nr_map_entries ==ARRAY_SIZE (map)) +grub_xen_early_halt (); + j =0 ; +for (i =0 ; i < nr_map_entries; i++)for (i = 0, j = 0; i <
nr_map_entries; i++)
Okay.
Juergen
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 12/18] xen: setup Xen specific data for PVH
Quoted 10 lines · Juergen Gross
Quoted 6 lines · Daniel Kiper
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 118
Quoted 2 lines · Juergen Gross
grub-core/kern/i386/xen/pvh.c +2
-0+ r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 );s/(grub_uint32_t) (&xhv)/(grub_uint32_t)(&xhv)/
Here and in the other patches...Oh, I have seen lots of places where casts are followed by a blank. I thought this would be the preferred style.
Doing some greps I've found about 9000 casts with a blank between (type) and casted value, but less than 3000 omitting the blank.
Is omitting the blank really preferred?
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 12/18] xen: setup Xen specific data for PVH
In reply to Juergen GrossQuoted 41 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +4
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static grub_uint32_t +grub_xen_get_param (int idx)
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 120
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 ); +if (r <0 ) +grub_xen_early_halt ();
At this point you already have access to the hypervisor console from the hypercall page, or alternatively you can use the 0xe9 IO port, IMO a debug message should be printed instead of just halting. Or else debugging failures is going to be quite complicated.
I would suggest to convert grub_xen_early_halt into grub_xen_early_crash and make it a printf like function, or at least take a string.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 12/18] xen: setup Xen specific data for PVH
In reply to Juergen GrossQuoted 41 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +4
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static grub_uint32_t +grub_xen_get_param (int idx)
grub-core/kern/i386/xen/pvh.c grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0, · line 120
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 ); +if (r <0 ) +grub_xen_early_halt ();
At this point you already have access to the hypervisor console from the hypercall page, or alternatively you can use the 0xe9 IO port, IMO a debug message should be printed instead of just halting. Or else debugging failures is going to be quite complicated.
I would suggest to convert grub_xen_early_halt into grub_xen_early_crash and make it a printf like function, or at least take a string.
Thanks, Roger.
Re: [PATCH v2 12/18] xen: setup Xen specific data for PVH
In reply to Juergen GrossQuoted 73 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +32
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 ); +if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 231
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +7
-0@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */
Doing this is kind of dangerous, what if you end up placing something on top of an MMIO region (either emulated or from a real passthrough device)?
Quoted 4 lines
grub-core/kern/i386/xen/pvh.c +4
-0+for (i =0 ; i < nr_map_entries; i++) + { +if (last > map[i].addr + map[i].len) +continue ;
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 245
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+if (last < map[i].addr) +return last; +if ((map[i].addr >>32 ) || ((map[i].addr + map[i].len) >>32 )) +break ; + last = map[i].addr + map[i].len; + } +if (i == nr_map_entries) +return last; + +/* No hole found, use the highest RAM page below 4G and reserve it. */
I would rather use a RAM page and populate if afterwards, so that the memory map returned by the Xen hypercall still matches the current physmap, or else update the memmap using XENMEM_set_memory_map?
This has the nasty side effect of shattering the p2m though.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 12/18] xen: setup Xen specific data for PVH
In reply to Juergen GrossQuoted 73 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +32
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 ); +if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 231
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +7
-0@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */
Doing this is kind of dangerous, what if you end up placing something on top of an MMIO region (either emulated or from a real passthrough device)?
Quoted 4 lines
grub-core/kern/i386/xen/pvh.c +4
-0+for (i =0 ; i < nr_map_entries; i++) + { +if (last > map[i].addr + map[i].len) +continue ;
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 245
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+if (last < map[i].addr) +return last; +if ((map[i].addr >>32 ) || ((map[i].addr + map[i].len) >>32 )) +break ; + last = map[i].addr + map[i].len; + } +if (i == nr_map_entries) +return last; + +/* No hole found, use the highest RAM page below 4G and reserve it. */
I would rather use a RAM page and populate if afterwards, so that the memory map returned by the Xen hypercall still matches the current physmap, or else update the memmap using XENMEM_set_memory_map?
This has the nasty side effect of shattering the p2m though.
Thanks, Roger.
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 12/18] xen: setup Xen specific data for PVH
Quoted 77 lines · Roger Pau Monné
Quoted 76 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +32
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 ); +if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); }
Quoted 11 lines
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 231
Quoted 7 lines
grub-core/kern/i386/xen/pvh.c +7
-0+static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */ Doing this is kind of dangerous, what if you end up placing something on top of an MMIO region (either emulated or from a real passthrough device)?
Shouldn't those be marked as "Reserved" in the memory map?
Quoted 20 lines
Quoted 5 lines
grub-core/kern/i386/xen/pvh.c +4
-0+for (i =0 ; i < nr_map_entries; i++) + { +if (last > map[i].addr + map[i].len) +continue ;grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 245
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +10
-0+if (last < map[i].addr) +return last; +if ((map[i].addr >>32 ) || ((map[i].addr + map[i].len) >>32 )) +break ; + last = map[i].addr + map[i].len; + } +if (i == nr_map_entries) +return last; + +/* No hole found, use the highest RAM page below 4G and reserve it. */ I would rather use a RAM page and populate if afterwards, so that the memory map returned by the Xen hypercall still matches the current physmap, or else update the memmap using
XENMEM_set_memory_map?
Quoted 1 line
This has the nasty side effect of shattering the p2m though.
Right, and this would be a noticeable performance hit.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 12/18] xen: setup Xen specific data for PVH
Quoted 90 lines · Juergen Gross
Quoted 77 lines · Roger Pau Monné
Quoted 76 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +32
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 ); +if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); }Quoted 11 lines
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 231
Quoted 7 lines
grub-core/kern/i386/xen/pvh.c +7
-0+static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */ Doing this is kind of dangerous, what if you end up placing something on top of an MMIO region (either emulated or from a real passthrough device)?
Quoted 1 line
Shouldn't those be marked as "Reserved" in the memory map?
I don't think BARs are guaranteed to be in areas marked as reserved in the memory map. Unless you also scan for PCI devices and make sure there's no device with a BAR in the area you are attempting to populate I think the above is not safe.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 12/18] xen: setup Xen specific data for PVH
In reply to Juergen GrossQuoted 90 lines · Juergen Gross
Quoted 77 lines · Roger Pau Monné
Quoted 76 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +32
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 ); +if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); }Quoted 11 lines
grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 231
Quoted 7 lines
grub-core/kern/i386/xen/pvh.c +7
-0+static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */ Doing this is kind of dangerous, what if you end up placing something on top of an MMIO region (either emulated or from a real passthrough device)?
Quoted 1 line
Shouldn't those be marked as "Reserved" in the memory map?
I don't think BARs are guaranteed to be in areas marked as reserved in the memory map. Unless you also scan for PCI devices and make sure there's no device with a BAR in the area you are attempting to populate I think the above is not safe.
Thanks, Roger.
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 12/18] xen: setup Xen specific data for PVH
Quoted 91 lines · Roger Pau Monné
Quoted 90 lines · Juergen Gross
Quoted 88 lines · Roger Pau Monné
Quoted 73 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +32
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 ); +if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 231
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +7
-0@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */ Doing this is kind of dangerous, what if you end up placing something on top of an MMIO region (either emulated or from a real passthrough device)?
Quoted 6 lines
Quoted 1 line
Shouldn't those be marked as "Reserved" in the memory map?
I don't think BARs are guaranteed to be in areas marked as reserved in the memory map. Unless you also scan for PCI devices and make sure there's no device with a BAR in the area you are attempting to populate I think the above is not safe.
So either I can add scanning the PCI bus (which wouldn't be too hard IMO), or we require Xen tools to add memory map entries with "Reserved" attribute for passed-through PCI device's MMIO-areas (we can still do that as PCI pass-through for PVH isn't possible yet AFAIK).
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 12/18] xen: setup Xen specific data for PVH
Quoted 99 lines · Juergen Gross
Quoted 91 lines · Roger Pau Monné
Quoted 90 lines · Juergen Gross
Quoted 88 lines · Roger Pau Monné
Quoted 73 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +32
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 ); +if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 231
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +7
-0@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */ Doing this is kind of dangerous, what if you end up placing something on top of an MMIO region (either emulated or from a real passthrough device)?
Quoted 6 lines
Quoted 1 line
Shouldn't those be marked as "Reserved" in the memory map?
I don't think BARs are guaranteed to be in areas marked as reserved in the memory map. Unless you also scan for PCI devices and make sure there's no device with a BAR in the area you are attempting to populate I think the above is not safe.
Quoted 5 lines
So either I can add scanning the PCI bus (which wouldn't be too hard IMO), or we require Xen tools to add memory map entries with "Reserved" attribute for passed-through PCI device's MMIO-areas (we can still do that as PCI pass-through for PVH isn't possible yet AFAIK).
Ideally (and that's kind of far away from what we are now), I would like to have an interface to request Xen for a range of gfns available to map stuff in them (grants/foreign mappings/shared page...). That interface could be a simple hypercall that would return such range, or an hypercall that could be used to fetch something akin to an 'extended memory map' with specific Xen information (like such regions).
In both cases this requires Xen having a clearer picture of the p2m, because any of the above solutions cannot rely on scanning the p2m table in order to figure out what's where.
So the only change I would request is that if you use a RAM page you update the memory map stored in Xen to match the new layout, by using the XENMEM_set_memory_map hypercall.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 12/18] xen: setup Xen specific data for PVH
In reply to Juergen GrossQuoted 99 lines · Juergen Gross
Quoted 91 lines · Roger Pau Monné
Quoted 90 lines · Juergen Gross
Quoted 88 lines · Roger Pau Monné
Quoted 73 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +32
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 ); +if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 231
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +7
-0@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */ Doing this is kind of dangerous, what if you end up placing something on top of an MMIO region (either emulated or from a real passthrough device)?
Quoted 6 lines
Quoted 1 line
Shouldn't those be marked as "Reserved" in the memory map?
I don't think BARs are guaranteed to be in areas marked as reserved in the memory map. Unless you also scan for PCI devices and make sure there's no device with a BAR in the area you are attempting to populate I think the above is not safe.
Quoted 5 lines
So either I can add scanning the PCI bus (which wouldn't be too hard IMO), or we require Xen tools to add memory map entries with "Reserved" attribute for passed-through PCI device's MMIO-areas (we can still do that as PCI pass-through for PVH isn't possible yet AFAIK).
Ideally (and that's kind of far away from what we are now), I would like to have an interface to request Xen for a range of gfns available to map stuff in them (grants/foreign mappings/shared page...). That interface could be a simple hypercall that would return such range, or an hypercall that could be used to fetch something akin to an 'extended memory map' with specific Xen information (like such regions).
In both cases this requires Xen having a clearer picture of the p2m, because any of the above solutions cannot rely on scanning the p2m table in order to figure out what's where.
So the only change I would request is that if you use a RAM page you update the memory map stored in Xen to match the new layout, by using the XENMEM_set_memory_map hypercall.
Thanks, Roger.
Juergen Gross
maintainerRe: [PATCH v2 12/18] xen: setup Xen specific data for PVH
Quoted 114 lines · Roger Pau Monné
Quoted 99 lines · Juergen Gross
Quoted 91 lines · Roger Pau Monné
Quoted 90 lines · Juergen Gross
Quoted 88 lines · Roger Pau Monné
Quoted 73 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +32
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 ); +if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 231
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +7
-0@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */ Doing this is kind of dangerous, what if you end up placing something on top of an MMIO region (either emulated or from a real passthrough device)?
Quoted 6 lines
Quoted 1 line
Shouldn't those be marked as "Reserved" in the memory map?
I don't think BARs are guaranteed to be in areas marked as reserved in the memory map. Unless you also scan for PCI devices and make sure there's no device with a BAR in the area you are attempting to populate I think the above is not safe.
Quoted 5 lines
So either I can add scanning the PCI bus (which wouldn't be too hard IMO), or we require Xen tools to add memory map entries with "Reserved" attribute for passed-through PCI device's MMIO-areas (we can still do that as PCI pass-through for PVH isn't possible yet AFAIK).
Ideally (and that's kind of far away from what we are now), I would like to have an interface to request Xen for a range of gfns available to map stuff in them (grants/foreign mappings/shared page...). That interface could be a simple hypercall that would return such range, or an hypercall that could be used to fetch something akin to an 'extended memory map' with specific Xen information (like such regions).
Quoted 7 lines
In both cases this requires Xen having a clearer picture of the p2m, because any of the above solutions cannot rely on scanning the p2m table in order to figure out what's where.
So the only change I would request is that if you use a RAM page you update the memory map stored in Xen to match the new layout, by using the
XENMEM_set_memory_maphypercall.
Okay, this is simple.
Nevertheless I'm adding the already finished patch for scanning the PCI devices to find MMIO areas.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [Xen-devel] [PATCH v2 12/18] xen: setup Xen specific data for PVH
In reply to Roger Pau MonnéQuoted 114 lines · Roger Pau Monné
Quoted 99 lines · Juergen Gross
Quoted 91 lines · Roger Pau Monné
Quoted 90 lines · Juergen Gross
Quoted 88 lines · Roger Pau Monné
Quoted 73 lines · Juergen Gross
Initialize the needed Xen specific data. This is:
- the Xen start of day page containing the console and Xenstore ring page PFN and event channel
- the grant table
- the shared info pageSet the RSDP address for the guest from the
start_infopage passed as boot parameter.Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+)grub-core/kern/i386/xen/pvh.c +32
-0@@ -24,6 +24,7 @@#include <grub/xen.h> #include <grub/i386/linux.h> #include <grub/machine/kernel.h> +#include <xen/hvm/params.h> #include <xen/memory.h> struct xen_machine_mmap_entry @@ -39,6 +40,7 @@ static struct { char _entry[32]; } hypercall_page[128] __attribute__ ((aligned (GRUB_XEN_PAGE_SIZE)));static grub_uint32_t xen_cpuid_base; +static struct start_info grub_xen_start_page;static struct xen_machine_mmap_entry map[128 ];static unsigned int nr_map_entries;@@ -104,6 +106,36 @@ grub_xen_hypercall (grub_uint32_t callno, grub_uint32_t a0,return __res; } +static grub_uint32_t +grub_xen_get_param (int idx) +{ +struct xen_hvm_param xhv; +int r; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + r =grub_xen_hypercall (__HYPERVISOR_hvm_op, HVMOP_get_param, + (grub_uint32_t) (&xhv),0 ,0 ,0 ,0 ); +if (r <0 ) +grub_xen_early_halt (); +return xhv.value; +} + +static void * +grub_xen_add_physmap (unsigned int space,void *addr) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = space; + xatp.gpfn = (grub_addr_t ) addr >>GRUB_XEN_LOG_PAGE_SIZE ; +if (grub_xen_hypercall (__HYPERVISOR_memory_op, XENMEM_add_to_physmap, + (grub_uint32_t) (&xatp),0 ,0 ,0 ,0 )) +grub_xen_early_halt (); +return addr; +} +static void grub_xen_sort_mmap (void ) {grub-core/kern/i386/xen/pvh.c grub_xen_get_mmap (void) · line 231
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +7
-0@@ -190,12 +222,87 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static grub_uint64_t +grub_xen_find_page (grub_uint64_t start) +{ +unsigned int i, j; +grub_uint64_t last = start; + +/* Try to find a e820 map hole below 4G. */ Doing this is kind of dangerous, what if you end up placing something on top of an MMIO region (either emulated or from a real passthrough device)?
Quoted 6 lines
Quoted 1 line
Shouldn't those be marked as "Reserved" in the memory map?
I don't think BARs are guaranteed to be in areas marked as reserved in the memory map. Unless you also scan for PCI devices and make sure there's no device with a BAR in the area you are attempting to populate I think the above is not safe.
Quoted 5 lines
So either I can add scanning the PCI bus (which wouldn't be too hard IMO), or we require Xen tools to add memory map entries with "Reserved" attribute for passed-through PCI device's MMIO-areas (we can still do that as PCI pass-through for PVH isn't possible yet AFAIK).
Ideally (and that's kind of far away from what we are now), I would like to have an interface to request Xen for a range of gfns available to map stuff in them (grants/foreign mappings/shared page...). That interface could be a simple hypercall that would return such range, or an hypercall that could be used to fetch something akin to an 'extended memory map' with specific Xen information (like such regions).
Quoted 7 lines
In both cases this requires Xen having a clearer picture of the p2m, because any of the above solutions cannot rely on scanning the p2m table in order to figure out what's where.
So the only change I would request is that if you use a RAM page you update the memory map stored in Xen to match the new layout, by using the
XENMEM_set_memory_maphypercall.
Okay, this is simple.
Nevertheless I'm adding the already finished patch for scanning the PCI devices to find MMIO areas.
Juergen
Juergen Gross
maintainerPATCH v2 13/18 xen: init memory regions for PVH
In reply to Juergen GrossAdd all usable memory regions to grub memory management and add the needed mmap iterate code.
As we are running in 32-bit mode don't add memory above 4GB.
--- grub-core/kern/i386/xen/pvh.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
grub-core/kern/i386/xen/pvh.c +35 -0
@@ -222,6 +222,30 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static void +grub_xen_mm_init_regions (void ) +{ +grub_uint64_t modend, from, to; +unsigned int i; + + modend =grub_modules_get_end (); + +for (i =0 ; i < nr_map_entries; i++) + { +if (map[i].type !=GRUB_MEMORY_AVAILABLE ) +continue ; + from = map[i].addr; + to = from + map[i].len; +if (from < modend) + from = modend; +if (from >= to || from >=0x100000000ULL ) +continue ; +if (to >0x100000000ULL ) + to =0x100000000ULL ; +grub_mm_init_region ((void *) (grub_addr_t ) from, to - from); + } +} +static grub_uint64_t grub_xen_find_page (grub_uint64_t start) {
@@ -302,10 +326,21 @@ grub_xen_setup_pvh (void) grub_xen_shared_info =grub_xen_add_physmap (XENMAPSPACE_shared_info, (void *) par); +grub_xen_mm_init_regions (); + grub_rsdp_addr = pvh_start_info->rsdp_paddr; }grub_err_t grub_machine_mmap_iterate (grub_memory_hook_t hook,void *hook_data) { +unsigned int i; + +for (i =0 ; i < nr_map_entries; i++) + { +if (map[i].len &&hook (map[i].addr, map[i].len, map[i].type, hook_data)) +break ; + } + +return GRUB_ERR_NONE ; }
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 13/18] xen: init memory regions for PVH
Quoted 2 lines · Juergen Gross
Add all usable memory regions to grub memory management and add the needed mmap iterate code.
I am missing a few words why this patch is needed. Especially why grub_machine_mmap_iterate() has to belong to this patch. However, I think that it should be introduced by patch in which grub_machine_mmap_iterate() is used at some point.
Quoted 53 lines
As we are running in 32-bit mode don't add memory above 4GB.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)grub-core/kern/i386/xen/pvh.c +26
-0@@ -222,6 +222,30 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static void +grub_xen_mm_init_regions (void ) +{ +grub_uint64_t modend, from, to; +unsigned int i; + + modend =grub_modules_get_end (); + +for (i =0 ; i < nr_map_entries; i++) + { +if (map[i].type !=GRUB_MEMORY_AVAILABLE ) +continue ; + from = map[i].addr; + to = from + map[i].len; +if (from < modend) + from = modend; +if (from >= to || from >=0x100000000ULL ) +continue ; +if (to >0x100000000ULL ) + to =0x100000000ULL ; +grub_mm_init_region ((void *) (grub_addr_t ) from, to - from); + } +} +static grub_uint64_t grub_xen_find_page (grub_uint64_t start) {@@ -302,10 +326,21 @@ grub_xen_setup_pvh (void) grub_xen_shared_info =grub_xen_add_physmap (XENMAPSPACE_shared_info, (void *) par); +grub_xen_mm_init_regions (); + grub_rsdp_addr = pvh_start_info->rsdp_paddr; }grub_err_t grub_machine_mmap_iterate (grub_memory_hook_t hook,void *hook_data)
grub-core/kern/i386/xen/pvh.c grub_xen_setup_pvh (void) · line 345
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +9
-0{ +unsigned int i; + +for (i =0 ; i < nr_map_entries; i++) + { +if (map[i].len &&hook (map[i].addr, map[i].len, map[i].type, hook_data)) +break ; + } + +return GRUB_ERR_NONE ;
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 13/18] xen: init memory regions for PVH
In reply to Juergen GrossQuoted 2 lines · Juergen Gross
Add all usable memory regions to grub memory management and add the needed mmap iterate code.
I am missing a few words why this patch is needed. Especially why grub_machine_mmap_iterate() has to belong to this patch. However, I think that it should be introduced by patch in which grub_machine_mmap_iterate() is used at some point.
Quoted 53 lines
As we are running in 32-bit mode don't add memory above 4GB.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)grub-core/kern/i386/xen/pvh.c +26
-0@@ -222,6 +222,30 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static void +grub_xen_mm_init_regions (void ) +{ +grub_uint64_t modend, from, to; +unsigned int i; + + modend =grub_modules_get_end (); + +for (i =0 ; i < nr_map_entries; i++) + { +if (map[i].type !=GRUB_MEMORY_AVAILABLE ) +continue ; + from = map[i].addr; + to = from + map[i].len; +if (from < modend) + from = modend; +if (from >= to || from >=0x100000000ULL ) +continue ; +if (to >0x100000000ULL ) + to =0x100000000ULL ; +grub_mm_init_region ((void *) (grub_addr_t ) from, to - from); + } +} +static grub_uint64_t grub_xen_find_page (grub_uint64_t start) {@@ -302,10 +326,21 @@ grub_xen_setup_pvh (void) grub_xen_shared_info =grub_xen_add_physmap (XENMAPSPACE_shared_info, (void *) par); +grub_xen_mm_init_regions (); + grub_rsdp_addr = pvh_start_info->rsdp_paddr; }grub_err_t grub_machine_mmap_iterate (grub_memory_hook_t hook,void *hook_data)
grub-core/kern/i386/xen/pvh.c grub_xen_setup_pvh (void) · line 345
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +9
-0{ +unsigned int i; + +for (i =0 ; i < nr_map_entries; i++) + { +if (map[i].len &&hook (map[i].addr, map[i].len, map[i].type, hook_data)) +break ; + } + +return GRUB_ERR_NONE ;
Daniel
Juergen Gross
maintainerRe: [PATCH v2 13/18] xen: init memory regions for PVH
Quoted 8 lines · Daniel Kiper
Quoted 2 lines · Juergen Gross
Add all usable memory regions to grub memory management and add the needed mmap iterate code.
I am missing a few words why this patch is needed. Especially why
grub_machine_mmap_iterate()has to belong to this patch. However, I think that it should be introduced by patch in whichgrub_machine_mmap_iterate()is used at some point.
That would again lead to one giant PVH patch which you didn't like.
grub_machine_mmap_iterate() is being used by grub common code like grub-core/lib/relocator.c or grub-core/mmap/mmap.c
grub_machine_mmap_iterate() belongs into this patch as it is the main user of the memory map introduced here.
Juergen
Quoted 52 lines
Quoted 52 lines
As we are running in 32-bit mode don't add memory above 4GB.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)grub-core/kern/i386/xen/pvh.c +26
-0@@ -222,6 +222,30 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static void +grub_xen_mm_init_regions (void ) +{ +grub_uint64_t modend, from, to; +unsigned int i; + + modend =grub_modules_get_end (); + +for (i =0 ; i < nr_map_entries; i++) + { +if (map[i].type !=GRUB_MEMORY_AVAILABLE ) +continue ; + from = map[i].addr; + to = from + map[i].len; +if (from < modend) + from = modend; +if (from >= to || from >=0x100000000ULL ) +continue ; +if (to >0x100000000ULL ) + to =0x100000000ULL ; +grub_mm_init_region ((void *) (grub_addr_t ) from, to - from); + } +} +static grub_uint64_t grub_xen_find_page (grub_uint64_t start) {@@ -302,10 +326,21 @@ grub_xen_setup_pvh (void) grub_xen_shared_info =grub_xen_add_physmap (XENMAPSPACE_shared_info, (void *) par); +grub_xen_mm_init_regions (); + grub_rsdp_addr = pvh_start_info->rsdp_paddr; }
Quoted 15 lines
grub-core/kern/i386/xen/pvh.c grub_xen_setup_pvh (void) · line 345
Quoted 12 lines
grub-core/kern/i386/xen/pvh.c +9
-0grub_err_t grub_machine_mmap_iterate (grub_memory_hook_t hook,void *hook_data) { +unsigned int i; + +for (i =0 ; i < nr_map_entries; i++) + { +if (map[i].len &&hook (map[i].addr, map[i].len, map[i].type, hook_data)) +break ; + } + +return GRUB_ERR_NONE ;Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [PATCH v2 13/18] xen: init memory regions for PVH
In reply to Daniel KiperQuoted 8 lines · Daniel Kiper
Quoted 2 lines · Juergen Gross
Add all usable memory regions to grub memory management and add the needed mmap iterate code.
I am missing a few words why this patch is needed. Especially why
grub_machine_mmap_iterate()has to belong to this patch. However, I think that it should be introduced by patch in whichgrub_machine_mmap_iterate()is used at some point.
That would again lead to one giant PVH patch which you didn't like.
grub_machine_mmap_iterate() is being used by grub common code like grub-core/lib/relocator.c or grub-core/mmap/mmap.c
grub_machine_mmap_iterate() belongs into this patch as it is the main user of the memory map introduced here.
Juergen
Quoted 67 lines
Quoted 54 lines
As we are running in 32-bit mode don't add memory above 4GB.
Signed-off-by Juergen Gross <[email protected]>--- grub-core/kern/i386/xen/pvh.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)grub-core/kern/i386/xen/pvh.c +26
-0@@ -222,6 +222,30 @@ grub_xen_get_mmap (void)grub_xen_sort_mmap (); } +static void +grub_xen_mm_init_regions (void ) +{ +grub_uint64_t modend, from, to; +unsigned int i; + + modend =grub_modules_get_end (); + +for (i =0 ; i < nr_map_entries; i++) + { +if (map[i].type !=GRUB_MEMORY_AVAILABLE ) +continue ; + from = map[i].addr; + to = from + map[i].len; +if (from < modend) + from = modend; +if (from >= to || from >=0x100000000ULL ) +continue ; +if (to >0x100000000ULL ) + to =0x100000000ULL ; +grub_mm_init_region ((void *) (grub_addr_t ) from, to - from); + } +} +static grub_uint64_t grub_xen_find_page (grub_uint64_t start) {@@ -302,10 +326,21 @@ grub_xen_setup_pvh (void) grub_xen_shared_info =grub_xen_add_physmap (XENMAPSPACE_shared_info, (void *) par); +grub_xen_mm_init_regions (); + grub_rsdp_addr = pvh_start_info->rsdp_paddr; }grub_err_t grub_machine_mmap_iterate (grub_memory_hook_t hook,void *hook_data)grub-core/kern/i386/xen/pvh.c grub_xen_setup_pvh (void) · line 345
Quoted 10 lines
grub-core/kern/i386/xen/pvh.c +9
-0{ +unsigned int i; + +for (i =0 ; i < nr_map_entries; i++) + { +if (map[i].len &&hook (map[i].addr, map[i].len, map[i].type, hook_data)) +break ; + } + +return GRUB_ERR_NONE ;Daniel
Re: [PATCH v2 13/18] xen: init memory regions for PVH
Quoted 10 lines · Juergen Gross
Quoted 8 lines · Daniel Kiper
Quoted 2 lines · Juergen Gross
Add all usable memory regions to grub memory management and add the needed mmap iterate code.
I am missing a few words why this patch is needed. Especially why
grub_machine_mmap_iterate()has to belong to this patch. However, I think that it should be introduced by patch in whichgrub_machine_mmap_iterate()is used at some point.
Quoted 7 lines
That would again lead to one giant PVH patch which you didn't like.
grub_machine_mmap_iterate()is being used by grub common code likegrub-core/lib/relocator.corgrub-core/mmap/mmap.c
grub_machine_mmap_iterate()belongs into this patch as it is the main user of the memory map introduced here.
OK, let's leave it here. Though commit message has to be updated accordingly.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 13/18] xen: init memory regions for PVH
In reply to Juergen GrossQuoted 10 lines · Juergen Gross
Quoted 8 lines · Daniel Kiper
Quoted 2 lines · Juergen Gross
Add all usable memory regions to grub memory management and add the needed mmap iterate code.
I am missing a few words why this patch is needed. Especially why
grub_machine_mmap_iterate()has to belong to this patch. However, I think that it should be introduced by patch in whichgrub_machine_mmap_iterate()is used at some point.
Quoted 7 lines
That would again lead to one giant PVH patch which you didn't like.
grub_machine_mmap_iterate()is being used by grub common code likegrub-core/lib/relocator.corgrub-core/mmap/mmap.c
grub_machine_mmap_iterate()belongs into this patch as it is the main user of the memory map introduced here.
OK, let's leave it here. Though commit message has to be updated accordingly.
Daniel
Juergen Gross
maintainerPATCH v2 14/18 xenpvh: add build runes for grub-core
In reply to Juergen GrossAdd the modifications to the build system needed to build a xenpvh grub.
--- gentpl.py | 4 ++-- grub-core/Makefile.am | 12 ++++++++++++ grub-core/Makefile.core.def | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-)
gentpl.py +2 -2
@@ -28,7 +28,7 @@ import re GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275", "x86_64_efi", - "i386_xen", "x86_64_xen", + "i386_xen", "x86_64_xen", "i386_xenpvh", "mips_loongson", "sparc64_ieee1275", "powerpc_ieee1275", "mips_arc", "ia64_efi", "mips_qemu_mips", "arm_uboot", "arm_efi", "arm64_efi",
@@ -71,7 +71,7 @@ GROUPS["videomodules"] = GRUB_PLATFORMS[:]; for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i) # Similar for terminfo -GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["xen"] + GROUPS["ieee1275"] + GROUPS["uboot"]; +GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips", "i386_xenpvh" ] + GROUPS["xen"] + GROUPS["ieee1275"] + GROUPS["uboot"]; GROUPS["terminfomodule"] = GRUB_PLATFORMS[:]; for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
grub-core/Makefile.am +12 -0
@@ -101,6 +101,18 @@ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h endif +if COND_i386_xenpvh +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/xen/hypercall.h +endif + if COND_i386_efi KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
grub-core/Makefile.core.def +35 -0
@@ -79,6 +79,8 @@ kernel = { i386_xen_ldflags = '$(TARGET_IMG_BASE_LDOPT),0'; x86_64_xen_ldflags = '$(TARGET_IMG_LDFLAGS)'; x86_64_xen_ldflags = '$(TARGET_IMG_BASE_LDOPT),0'; + i386_xenpvh_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_xenpvh_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x100000'; mips_loongson_ldflags = '-Wl,-Ttext,0x80200000'; powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000';
@@ -100,6 +102,7 @@ kernel = { x86_64_efi_startup = kern/x86_64/efi/startup.S; i386_xen_startup = kern/i386/xen/startup.S; x86_64_xen_startup = kern/x86_64/xen/startup.S; + i386_xenpvh_startup = kern/i386/xen/startup_pvh.S; i386_qemu_startup = kern/i386/qemu/startup.S; i386_ieee1275_startup = kern/i386/ieee1275/startup.S; i386_coreboot_startup = kern/i386/coreboot/startup.S;
@@ -177,6 +180,7 @@ kernel = { i386 = kern/i386/dl.c; i386_xen = kern/i386/dl.c; + i386_xenpvh = kern/i386/dl.c; i386_coreboot = kern/i386/coreboot/init.c; i386_multiboot = kern/i386/coreboot/init.c;
@@ -222,6 +226,14 @@ kernel = { xen = disk/xen/xendisk.c; xen = commands/boot.c; + i386_xenpvh = kern/i386/tsc.c; + i386_xenpvh = kern/i386/xen/tsc.c; + i386_xenpvh = commands/boot.c; + i386_xenpvh = kern/xen/init.c; + i386_xenpvh = kern/i386/xen/pvh.c; + i386_xenpvh = term/xen/console.c; + i386_xenpvh = disk/xen/xendisk.c; + ia64_efi = kern/ia64/efi/startup.S; ia64_efi = kern/ia64/efi/init.c; ia64_efi = kern/ia64/dl.c;
@@ -801,6 +813,7 @@ module = { name = cpuid; common = commands/i386/cpuid.c; enable = x86; + enable = i386_xenpvh; enable = i386_xen; enable = x86_64_xen; };
@@ -860,6 +873,7 @@ module = { i386_coreboot = lib/i386/halt.c; i386_qemu = lib/i386/halt.c; xen = lib/xen/halt.c; + i386_xenpvh = lib/xen/halt.c; efi = lib/efi/halt.c; ieee1275 = lib/ieee1275/halt.c; emu = lib/emu/halt.c;
@@ -877,6 +891,7 @@ module = { mips_loongson = lib/mips/loongson/reboot.c; mips_qemu_mips = lib/mips/qemu_mips/reboot.c; xen = lib/xen/reboot.c; + i386_xenpvh = lib/xen/reboot.c; uboot = lib/uboot/reboot.c; arm_coreboot = lib/dummy/reboot.c; common = commands/reboot.c;
@@ -1545,12 +1560,18 @@ module = { x86 = lib/i386/relocator16.S; x86 = lib/i386/relocator32.S; x86 = lib/i386/relocator64.S; + i386_xenpvh = lib/i386/relocator16.S; + i386_xenpvh = lib/i386/relocator32.S; + i386_xenpvh = lib/i386/relocator64.S; i386 = lib/i386/relocator_asm.S; + i386_xenpvh = lib/i386/relocator_asm.S; x86_64 = lib/x86_64/relocator_asm.S; i386_xen = lib/i386/relocator_asm.S; x86_64_xen = lib/x86_64/relocator_asm.S; x86 = lib/i386/relocator.c; x86 = lib/i386/relocator_common_c.c; + i386_xenpvh = lib/i386/relocator.c; + i386_xenpvh = lib/i386/relocator_common_c.c; ieee1275 = lib/ieee1275/relocator.c; efi = lib/efi/relocator.c; mips = lib/mips/relocator_asm.S;
@@ -1569,6 +1590,7 @@ module = { enable = mips; enable = powerpc; enable = x86; + enable = i386_xenpvh; enable = xen; };
@@ -1583,6 +1605,7 @@ module = { sparc64_ieee1275 = lib/ieee1275/cmos.c; powerpc_ieee1275 = lib/ieee1275/cmos.c; xen = lib/xen/datetime.c; + i386_xenpvh = lib/xen/datetime.c; mips_arc = lib/arc/datetime.c; enable = noemu;
@@ -1666,6 +1689,7 @@ module = { common = loader/multiboot.c; common = loader/multiboot_mbi2.c; enable = x86; + enable = i386_xenpvh; enable = mips; };
@@ -1673,8 +1697,10 @@ module = { name = multiboot; common = loader/multiboot.c; x86 = loader/i386/multiboot_mbi.c; + i386_xenpvh = loader/i386/multiboot_mbi.c; extra_dist = loader/multiboot_elfxx.c; enable = x86; + enable = i386_xenpvh; }; module = {
@@ -1686,8 +1712,10 @@ module = { module = { name = linux; x86 = loader/i386/linux.c; + i386_xenpvh = loader/i386/linux.c; xen = loader/i386/xen.c; i386_pc = lib/i386/pc/vesa_modes_table.c; + i386_xenpvh = lib/i386/pc/vesa_modes_table.c; mips = loader/mips/linux.c; powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c; sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
@@ -1775,6 +1803,8 @@ module = { common = mmap/mmap.c; x86 = mmap/i386/uppermem.c; x86 = mmap/i386/mmap.c; + i386_xenpvh = mmap/i386/uppermem.c; + i386_xenpvh = mmap/i386/mmap.c; i386_pc = mmap/i386/pc/mmap.c; i386_pc = mmap/i386/pc/mmap_helper.S;
@@ -1784,6 +1814,7 @@ module = { mips = mmap/mips/uppermem.c; enable = x86; + enable = i386_xenpvh; enable = ia64_efi; enable = arm_efi; enable = arm64_efi;
@@ -2023,6 +2054,7 @@ module = { name = legacy_password_test; common = tests/legacy_password_test.c; enable = i386_pc; + enable = i386_xenpvh; enable = i386_efi; enable = x86_64_efi; enable = emu;
@@ -2221,6 +2253,7 @@ module = { xen = lib/i386/pc/vesa_modes_table.c; enable = i386_pc; + enable = i386_xenpvh; enable = i386_efi; enable = x86_64_efi; enable = emu;
@@ -2264,10 +2297,12 @@ module = { module = { name = backtrace; x86 = lib/i386/backtrace.c; + i386_xenpvh = lib/i386/backtrace.c; i386_xen = lib/i386/backtrace.c; x86_64_xen = lib/i386/backtrace.c; common = lib/backtrace.c; enable = x86; + enable = i386_xenpvh; enable = i386_xen; enable = x86_64_xen; };
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 14/18] xenpvh: add build runes for grub-core
Quoted 16 lines · Juergen Gross
Add the modifications to the build system needed to build a xenpvh grub.
Signed-off-by Juergen Gross <[email protected]>Reviewed-by Daniel Kiper <[email protected]>--- gentpl.py | 4 ++-- grub-core/Makefile.am | 12 ++++++++++++ grub-core/Makefile.core.def | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-)gentpl.py +0
-0
gentpl.py import re · line 31
Quoted 5 lines
gentpl.py +1
-1@@ -28,7 +28,7 @@ import re GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275", "x86_64_efi", - "i386_xen", "x86_64_xen", + "i386_xen", "x86_64_xen", "i386_xenpvh",
s/i386_xenpvh/i386_xen_pvh/ here and below please...
Quoted 65 lines
gentpl.py +1
-1"mips_loongson", "sparc64_ieee1275", "powerpc_ieee1275", "mips_arc", "ia64_efi", "mips_qemu_mips", "arm_uboot", "arm_efi", "arm64_efi",@@ -71,7 +71,7 @@ GROUPS["videomodules"] = GRUB_PLATFORMS[:]; for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i) # Similar for terminfo -GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["xen"] + GROUPS["ieee1275"] + GROUPS["uboot"]; +GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips", "i386_xenpvh" ] + GROUPS["xen"] + GROUPS["ieee1275"] + GROUPS["uboot"]; GROUPS["terminfomodule"] = GRUB_PLATFORMS[:]; for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)grub-core/Makefile.am +12
-0@@ -101,6 +101,18 @@ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h endif +if COND_i386_xenpvh +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/xen/hypercall.h +endif + if COND_i386_efi KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.hgrub-core/Makefile.core.def +4
-0@@ -79,6 +79,8 @@ kernel = { i386_xen_ldflags = '$(TARGET_IMG_BASE_LDOPT),0'; x86_64_xen_ldflags = '$(TARGET_IMG_LDFLAGS)'; x86_64_xen_ldflags = '$(TARGET_IMG_BASE_LDOPT),0'; + i386_xenpvh_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_xenpvh_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x100000'; mips_loongson_ldflags = '-Wl,-Ttext,0x80200000'; powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000';@@ -100,6 +102,7 @@ kernel = { x86_64_efi_startup = kern/x86_64/efi/startup.S; i386_xen_startup = kern/i386/xen/startup.S; x86_64_xen_startup = kern/x86_64/xen/startup.S; + i386_xenpvh_startup = kern/i386/xen/startup_pvh.S; i386_qemu_startup = kern/i386/qemu/startup.S; i386_ieee1275_startup = kern/i386/ieee1275/startup.S; i386_coreboot_startup = kern/i386/coreboot/startup.S;@@ -177,6 +180,7 @@ kernel = { i386 = kern/i386/dl.c; i386_xen = kern/i386/dl.c; + i386_xenpvh = kern/i386/dl.c; i386_coreboot = kern/i386/coreboot/init.c; i386_multiboot = kern/i386/coreboot/init.c;
grub-core/Makefile.core.def kernel = { · line 235
Quoted 10 lines
grub-core/Makefile.core.def +7
-0@@ -222,6 +226,14 @@ kernel = { xen = disk/xen/xendisk.c; xen = commands/boot.c; + i386_xenpvh = kern/i386/tsc.c; + i386_xenpvh = kern/i386/xen/tsc.c; + i386_xenpvh = commands/boot.c; + i386_xenpvh = kern/xen/init.c; + i386_xenpvh = kern/i386/xen/pvh.c; + i386_xenpvh = term/xen/console.c; + i386_xenpvh = disk/xen/xendisk.c;
I would sort all file names here.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 14/18] xenpvh: add build runes for grub-core
In reply to Juergen GrossQuoted 16 lines · Juergen Gross
Add the modifications to the build system needed to build a xenpvh grub.
Signed-off-by Juergen Gross <[email protected]>Reviewed-by Daniel Kiper <[email protected]>--- gentpl.py | 4 ++-- grub-core/Makefile.am | 12 ++++++++++++ grub-core/Makefile.core.def | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-)gentpl.py +0
-0
gentpl.py import re · line 31
Quoted 5 lines
gentpl.py +1
-1@@ -28,7 +28,7 @@ import re GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275", "x86_64_efi", - "i386_xen", "x86_64_xen", + "i386_xen", "x86_64_xen", "i386_xenpvh",
s/i386_xenpvh/i386_xen_pvh/ here and below please...
Quoted 65 lines
gentpl.py +1
-1"mips_loongson", "sparc64_ieee1275", "powerpc_ieee1275", "mips_arc", "ia64_efi", "mips_qemu_mips", "arm_uboot", "arm_efi", "arm64_efi",@@ -71,7 +71,7 @@ GROUPS["videomodules"] = GRUB_PLATFORMS[:]; for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i) # Similar for terminfo -GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["xen"] + GROUPS["ieee1275"] + GROUPS["uboot"]; +GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips", "i386_xenpvh" ] + GROUPS["xen"] + GROUPS["ieee1275"] + GROUPS["uboot"]; GROUPS["terminfomodule"] = GRUB_PLATFORMS[:]; for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)grub-core/Makefile.am +12
-0@@ -101,6 +101,18 @@ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h endif +if COND_i386_xenpvh +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/xen/hypercall.h +endif + if COND_i386_efi KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.hgrub-core/Makefile.core.def +4
-0@@ -79,6 +79,8 @@ kernel = { i386_xen_ldflags = '$(TARGET_IMG_BASE_LDOPT),0'; x86_64_xen_ldflags = '$(TARGET_IMG_LDFLAGS)'; x86_64_xen_ldflags = '$(TARGET_IMG_BASE_LDOPT),0'; + i386_xenpvh_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_xenpvh_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x100000'; mips_loongson_ldflags = '-Wl,-Ttext,0x80200000'; powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000';@@ -100,6 +102,7 @@ kernel = { x86_64_efi_startup = kern/x86_64/efi/startup.S; i386_xen_startup = kern/i386/xen/startup.S; x86_64_xen_startup = kern/x86_64/xen/startup.S; + i386_xenpvh_startup = kern/i386/xen/startup_pvh.S; i386_qemu_startup = kern/i386/qemu/startup.S; i386_ieee1275_startup = kern/i386/ieee1275/startup.S; i386_coreboot_startup = kern/i386/coreboot/startup.S;@@ -177,6 +180,7 @@ kernel = { i386 = kern/i386/dl.c; i386_xen = kern/i386/dl.c; + i386_xenpvh = kern/i386/dl.c; i386_coreboot = kern/i386/coreboot/init.c; i386_multiboot = kern/i386/coreboot/init.c;
grub-core/Makefile.core.def kernel = { · line 235
Quoted 10 lines
grub-core/Makefile.core.def +7
-0@@ -222,6 +226,14 @@ kernel = { xen = disk/xen/xendisk.c; xen = commands/boot.c; + i386_xenpvh = kern/i386/tsc.c; + i386_xenpvh = kern/i386/xen/tsc.c; + i386_xenpvh = commands/boot.c; + i386_xenpvh = kern/xen/init.c; + i386_xenpvh = kern/i386/xen/pvh.c; + i386_xenpvh = term/xen/console.c; + i386_xenpvh = disk/xen/xendisk.c;
I would sort all file names here.
Daniel
Juergen Gross
maintainerRe: [PATCH v2 14/18] xenpvh: add build runes for grub-core
Quoted 18 lines · Daniel Kiper
Quoted 17 lines · Juergen Gross
Add the modifications to the build system needed to build a xenpvh grub.
Signed-off-by Juergen Gross <[email protected]>Reviewed-by Daniel Kiper <[email protected]>--- gentpl.py | 4 ++-- grub-core/Makefile.am | 12 ++++++++++++ grub-core/Makefile.core.def | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-)gentpl.py +0
-0@@ -28,7 +28,7 @@ import re
Quoted 6 lines
gentpl.py import re · line 31
Quoted 4 lines
gentpl.py +1
-1GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275", "x86_64_efi", - "i386_xen", "x86_64_xen", + "i386_xen", "x86_64_xen", "i386_xenpvh",s/i386_xenpvh/i386_xen_pvh/ here and below please...
... which is the answer to the question I had to your request for patch
07. I'll change it accordingly.
Quoted 69 lines
Quoted 69 lines
gentpl.py +1
-1"mips_loongson", "sparc64_ieee1275", "powerpc_ieee1275", "mips_arc", "ia64_efi", "mips_qemu_mips", "arm_uboot", "arm_efi", "arm64_efi",@@ -71,7 +71,7 @@ GROUPS["videomodules"] = GRUB_PLATFORMS[:]; for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i) # Similar for terminfo -GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["xen"] + GROUPS["ieee1275"] + GROUPS["uboot"]; +GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips", "i386_xenpvh" ] + GROUPS["xen"] + GROUPS["ieee1275"] + GROUPS["uboot"]; GROUPS["terminfomodule"] = GRUB_PLATFORMS[:]; for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)grub-core/Makefile.am +12
-0@@ -101,6 +101,18 @@ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h endif +if COND_i386_xenpvh +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/xen/hypercall.h +endif + if COND_i386_efi KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.hgrub-core/Makefile.core.def +4
-0@@ -79,6 +79,8 @@ kernel = { i386_xen_ldflags = '$(TARGET_IMG_BASE_LDOPT),0'; x86_64_xen_ldflags = '$(TARGET_IMG_LDFLAGS)'; x86_64_xen_ldflags = '$(TARGET_IMG_BASE_LDOPT),0'; + i386_xenpvh_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_xenpvh_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x100000'; mips_loongson_ldflags = '-Wl,-Ttext,0x80200000'; powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000';@@ -100,6 +102,7 @@ kernel = { x86_64_efi_startup = kern/x86_64/efi/startup.S; i386_xen_startup = kern/i386/xen/startup.S; x86_64_xen_startup = kern/x86_64/xen/startup.S; + i386_xenpvh_startup = kern/i386/xen/startup_pvh.S; i386_qemu_startup = kern/i386/qemu/startup.S; i386_ieee1275_startup = kern/i386/ieee1275/startup.S; i386_coreboot_startup = kern/i386/coreboot/startup.S;@@ -177,6 +180,7 @@ kernel = { i386 = kern/i386/dl.c; i386_xen = kern/i386/dl.c; + i386_xenpvh = kern/i386/dl.c; i386_coreboot = kern/i386/coreboot/init.c; i386_multiboot = kern/i386/coreboot/init.c;@@ -222,6 +226,14 @@ kernel = { xen = disk/xen/xendisk.c; xen = commands/boot.c;
Quoted 9 lines
grub-core/Makefile.core.def kernel = { · line 235
Quoted 7 lines
grub-core/Makefile.core.def +7
-0+ i386_xenpvh = kern/i386/tsc.c; + i386_xenpvh = kern/i386/xen/tsc.c; + i386_xenpvh = commands/boot.c; + i386_xenpvh = kern/xen/init.c; + i386_xenpvh = kern/i386/xen/pvh.c; + i386_xenpvh = term/xen/console.c; + i386_xenpvh = disk/xen/xendisk.c;I would sort all file names here.
Okay.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v2 15/18 grub-module-verifier: Ignore all_video for xenpvh
In reply to Juergen GrossFrom: Hans van Kranenburg <[email protected]>
This solves the build failing with "Error: no symbol table and no .moddeps section"
Also see:
- 6371e9c10433578bb236a8284ddb9ce9e201eb59
- https://savannah.gnu.org/bugs/?49012
---
V2: new patch
--- util/grub-module-verifier.c | 1 + 1 file changed, 1 insertion(+)
util/grub-module-verifier.c +1 -0
@@ -129,6 +129,7 @@ struct platform_whitelist {static struct platform_whitelist whitelists[] = { {"i386" ,"xen" , (const char *[]) {"all_video" ,0 }}, + {"i386" ,"xenpvh" , (const char *[]) {"all_video" ,0 }}, {"x86_64" ,"xen" , (const char *[]) {"all_video" ,0 }}, {"sparc64" ,"ieee1275" , (const char *[]) {"all_video" ,0 }},
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 15/18] grub-module-verifier: Ignore all_video for xenpvh
Quoted 10 lines · Juergen Gross
From: Hans van Kranenburg <[email protected]>
This solves the build failing with "Error: no symbol table and no .moddeps section"
Also see:
-6371e9c10433578bb236a8284ddb9ce9e201eb59
- https://savannah.gnu.org/bugs/?49012Signed-off-by Hans van Kranenburg <[email protected]>
Except s/xenpvh/xen_pvh/ Reviewed-by: Daniel Kiper <[email protected]>
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 15/18] grub-module-verifier: Ignore all_video for xenpvh
In reply to Juergen GrossQuoted 10 lines · Juergen Gross
From: Hans van Kranenburg <[email protected]>
This solves the build failing with "Error: no symbol table and no .moddeps section"
Also see:
-6371e9c10433578bb236a8284ddb9ce9e201eb59
- https://savannah.gnu.org/bugs/?49012Signed-off-by Hans van Kranenburg <[email protected]>
Except s/xenpvh/xen_pvh/ Reviewed-by: Daniel Kiper <[email protected]>
Daniel
Juergen Gross
maintainerPATCH v2 16/18 xenpvh: support building a standalone image
In reply to Juergen GrossSupport mkimage for xenpvh.
In order to avoid using plain integers for the ELF notes use the available Xen include instead. While at it replace the plain numbers for Xen PV mode, too.
---
V2: some style adjustments (Daniel Kiper)
use defines for elf-notes (Daniel Kiper)
I didn't replace the 4096 by a PAGE_SIZE macro as requested by Daniel, as there isn't such a macro easily available for util/mkimage.c and I didn't introduce its usage.
--- include/grub/util/mkimage.h | 3 ++- util/grub-mkimage32.c | 4 +++- util/grub-mkimage64.c | 4 +++- util/grub-mkimagexx.c | 58 +++++++++++++++++++++++++++++++++++++-------- util/mkimage.c | 23 +++++++++++++++++- 5 files changed, 78 insertions(+), 14 deletions(-)
include/grub/util/mkimage.h +2 -1
@@ -71,7 +71,8 @@ struct grub_install_image_target_descIMAGE_I386_IEEE1275 ,IMAGE_LOONGSON_ELF ,IMAGE_QEMU ,IMAGE_PPC ,IMAGE_YEELOONG_FLASH ,IMAGE_FULOONG2F_FLASH ,IMAGE_I386_PC_PXE ,IMAGE_MIPS_ARC , -IMAGE_QEMU_MIPS_FLASH ,IMAGE_UBOOT ,IMAGE_XEN ,IMAGE_I386_PC_ELTORITO +IMAGE_QEMU_MIPS_FLASH ,IMAGE_UBOOT ,IMAGE_XEN ,IMAGE_I386_PC_ELTORITO , +IMAGE_XENPVH } id;enum {
util/grub-mkimage32.c +3 -1
@@ -17,7 +17,9 @@# define ELF_R_SYM (val) ELF32_R_SYM(val)# define ELF_R_TYPE (val) ELF32_R_TYPE(val)# define ELF_ST_TYPE (val) ELF32_ST_TYPE(val) -#define XEN_NOTE_SIZE 132 + +#define XEN_NOTE_SIZE 132 +#define XENPVH_NOTE_SIZE 20#ifndef GRUB_MKIMAGEXX #include "grub-mkimagexx.c"
util/grub-mkimage64.c +3 -1
@@ -17,7 +17,9 @@# define ELF_R_SYM (val) ELF64_R_SYM(val)# define ELF_R_TYPE (val) ELF64_R_TYPE(val)# define ELF_ST_TYPE (val) ELF64_ST_TYPE(val) -#define XEN_NOTE_SIZE 120 + +#define XEN_NOTE_SIZE 120 +#define XENPVH_NOTE_SIZE 24#ifndef GRUB_MKIMAGEXX #include "grub-mkimagexx.c"
util/grub-mkimagexx.c +48 -10
128 lines not on this page · raw message
util/mkimage.c +22 -1
@@ -132,6 +132,24 @@ static const struct grub_install_image_target_desc image_targets[] = .link_addr = GRUB_KERNEL_I386_PC_LINK_ADDR, .default_compression = GRUB_COMPRESSION_LZMA }, + { + .dirname = "i386-xenpvh", + .names = { "i386-xenpvh", NULL }, + .voidp_sizeof = 4, + .bigendian = 0, + .id = IMAGE_XENPVH, + .flags = PLATFORM_FLAGS_NONE, + .total_module_size = TARGET_NO_FIELD, + .decompressor_compressed_size = TARGET_NO_FIELD, + .decompressor_uncompressed_size = TARGET_NO_FIELD, + .decompressor_uncompressed_addr = TARGET_NO_FIELD, + .elf_target = EM_386, + .section_align = 1, + .vaddr_offset = 0, + .link_addr = GRUB_KERNEL_I386_XENPVH_LINK_ADDR, + .mod_align = GRUB_KERNEL_I386_XENPVH_MOD_ALIGN, + .link_align = 4 + }, { .dirname ="i386-pc" , .names = { "i386-pc-pxe", NULL },
@@ -860,7 +878,8 @@ grub_install_generate_image (const char *dir, const char *prefix,else kernel_img =grub_mkimage_load_image64 (kernel_path, total_module_size, &layout, image_target); -if (image_target->id ==IMAGE_XEN && layout.align <4096 ) +if ((image_target->id ==IMAGE_XEN || image_target->id ==IMAGE_XENPVH ) && + layout.align <4096 ) layout.align =4096 ; if ((image_target->flags & PLATFORM_FLAGS_DECOMPRESSORS)
@@ -1103,6 +1122,7 @@ grub_install_generate_image (const char *dir, const char *prefix,case IMAGE_MIPS_ARC :case IMAGE_QEMU_MIPS_FLASH :case IMAGE_XEN : +case IMAGE_XENPVH :break ;case IMAGE_SPARC64_AOUT :case IMAGE_SPARC64_RAW :
@@ -1679,6 +1699,7 @@ grub_install_generate_image (const char *dir, const char *prefix,case IMAGE_LOONGSON_ELF :case IMAGE_PPC :case IMAGE_XEN : +case IMAGE_XENPVH :case IMAGE_COREBOOT :case IMAGE_I386_IEEE1275 : {
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 16/18] xenpvh: support building a standalone image
Quoted 7 lines · Juergen Gross
Support mkimage for xenpvh.
In order to avoid using plain integers for the ELF notes use the available Xen include instead. While at it replace the plain numbers for Xen PV mode, too.
Signed-off-by Juergen Gross <[email protected]>
+/- XENPVH/xenpvh play Reviewed-by: Daniel Kiper <[email protected]>
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 16/18] xenpvh: support building a standalone image
In reply to Juergen GrossQuoted 7 lines · Juergen Gross
Support mkimage for xenpvh.
In order to avoid using plain integers for the ELF notes use the available Xen include instead. While at it replace the plain numbers for Xen PV mode, too.
Signed-off-by Juergen Gross <[email protected]>
+/- XENPVH/xenpvh play Reviewed-by: Daniel Kiper <[email protected]>
Daniel
Juergen Gross
maintainerPATCH v2 17/18 xenpvh: support grub-install for xenpvh
In reply to Juergen GrossAdd xenpvh support to grub-install.
--- include/grub/util/install.h | 1 + util/grub-install-common.c | 1 + util/grub-install.c | 7 +++++++ 3 files changed, 9 insertions(+)
include/grub/util/install.h +1 -0
@@ -100,6 +100,7 @@ enum grub_install_platGRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS ,GRUB_INSTALL_PLATFORM_I386_XEN ,GRUB_INSTALL_PLATFORM_X86_64_XEN , +GRUB_INSTALL_PLATFORM_I386_XENPVH ,GRUB_INSTALL_PLATFORM_ARM64_EFI ,GRUB_INSTALL_PLATFORM_ARM_COREBOOT ,GRUB_INSTALL_PLATFORM_MAX
util/grub-install-common.c +1 -0
@@ -716,6 +716,7 @@ static struct [GRUB_INSTALL_PLATFORM_X86_64_EFI] = { "x86_64", "efi" }, [GRUB_INSTALL_PLATFORM_I386_XEN] = { "i386", "xen" }, [GRUB_INSTALL_PLATFORM_X86_64_XEN] = { "x86_64", "xen" }, + [GRUB_INSTALL_PLATFORM_I386_XENPVH] = { "i386", "xenpvh" }, [GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON] = { "mipsel", "loongson" }, [GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS] = { "mipsel", "qemu_mips" }, [GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS] = { "mips", "qemu_mips" },
util/grub-install.c +7 -0
@@ -496,6 +496,7 @@ have_bootdev (enum grub_install_plat pl)case GRUB_INSTALL_PLATFORM_I386_XEN :case GRUB_INSTALL_PLATFORM_X86_64_XEN : +case GRUB_INSTALL_PLATFORM_I386_XENPVH :return 0 ;/* pacify warning. */
@@ -913,6 +914,7 @@ main (int argc, char *argv[])case GRUB_INSTALL_PLATFORM_ARM_UBOOT :case GRUB_INSTALL_PLATFORM_I386_XEN :case GRUB_INSTALL_PLATFORM_X86_64_XEN : +case GRUB_INSTALL_PLATFORM_I386_XENPVH :break ;case GRUB_INSTALL_PLATFORM_I386_QEMU :
@@ -960,6 +962,7 @@ main (int argc, char *argv[])case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS :case GRUB_INSTALL_PLATFORM_I386_XEN :case GRUB_INSTALL_PLATFORM_X86_64_XEN : +case GRUB_INSTALL_PLATFORM_I386_XENPVH :free (install_device); install_device =NULL ;break ;
@@ -1477,6 +1480,7 @@ main (int argc, char *argv[])case GRUB_INSTALL_PLATFORM_ARM_UBOOT :case GRUB_INSTALL_PLATFORM_I386_XEN :case GRUB_INSTALL_PLATFORM_X86_64_XEN : +case GRUB_INSTALL_PLATFORM_I386_XENPVH :grub_util_warn ("%s" ,_ ("no hints available for your platform. Expect reduced performance" ));break ;/* pacify warning. */
@@ -1568,6 +1572,7 @@ main (int argc, char *argv[])case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275 :case GRUB_INSTALL_PLATFORM_I386_XEN :case GRUB_INSTALL_PLATFORM_X86_64_XEN : +case GRUB_INSTALL_PLATFORM_I386_XENPVH : core_name ="core.elf" ; snprintf (mkimage_target, sizeof (mkimage_target), "%s-%s",
@@ -1660,6 +1665,7 @@ main (int argc, char *argv[])case GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275 :case GRUB_INSTALL_PLATFORM_I386_XEN :case GRUB_INSTALL_PLATFORM_X86_64_XEN : +case GRUB_INSTALL_PLATFORM_I386_XENPVH :break ;/* pacify warning. */ case GRUB_INSTALL_PLATFORM_MAX :
@@ -1926,6 +1932,7 @@ main (int argc, char *argv[])case GRUB_INSTALL_PLATFORM_I386_QEMU :case GRUB_INSTALL_PLATFORM_I386_XEN :case GRUB_INSTALL_PLATFORM_X86_64_XEN : +case GRUB_INSTALL_PLATFORM_I386_XENPVH :grub_util_warn ("%s" ,_ ("WARNING: no platform-specific install was performed" ));break ;
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 17/18] xenpvh: support grub-install for xenpvh
Quoted 4 lines · Juergen Gross
Add xenpvh support to grub-install.
Signed-off-by Juergen Gross <[email protected]>Reviewed-by Daniel Kiper <[email protected]>
+/- XENPVH play still Reviewed-by: Daniel Kiper <[email protected]>
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 17/18] xenpvh: support grub-install for xenpvh
In reply to Juergen GrossQuoted 4 lines · Juergen Gross
Add xenpvh support to grub-install.
Signed-off-by Juergen Gross <[email protected]>Reviewed-by Daniel Kiper <[email protected]>
+/- XENPVH play still Reviewed-by: Daniel Kiper <[email protected]>
Daniel
Juergen Gross
maintainerPATCH v2 18/18 xenpvh: add support to configure
In reply to Juergen GrossSupport platform i386/xenpvh in configure.
--- configure.ac | 3 +++ 1 file changed, 3 insertions(+)
configure.ac +3 -0
@@ -151,6 +151,7 @@ case "$target_cpu"-"$platform" in i386-efi) ;; x86_64-efi) ;; i386-xen) ;; + i386-xenpvh) ;; x86_64-xen) ;; i386-pc) ;; i386-multiboot) ;;
@@ -219,6 +220,7 @@ case "$platform" in multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;; efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;; xen) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN=1" ;; + xenpvh) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XENPVH=1" ;; ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;; uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;; qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
@@ -1897,6 +1899,7 @@ AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot]) AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi]) AM_CONDITIONAL([COND_i386_xen], [test x$target_cpu = xi386 -a x$platform = xxen]) +AM_CONDITIONAL([COND_i386_xenpvh], [test x$target_cpu = xi386 -a x$platform = xxenpvh]) AM_CONDITIONAL([COND_x86_64_xen], [test x$target_cpu = xx86_64 -a x$platform = xxen]) AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson]) AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 18/18] xenpvh: add support to configure
Quoted 4 lines · Juergen Gross
Support platform i386/xenpvh in configure.
Signed-off-by Juergen Gross <[email protected]>Reviewed-by Daniel Kiper <[email protected]>
+/- XENPVH/xenpvh play still Reviewed-by: Daniel Kiper <[email protected]>
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 18/18] xenpvh: add support to configure
In reply to Juergen GrossQuoted 4 lines · Juergen Gross
Support platform i386/xenpvh in configure.
Signed-off-by Juergen Gross <[email protected]>Reviewed-by Daniel Kiper <[email protected]>
+/- XENPVH/xenpvh play still Reviewed-by: Daniel Kiper <[email protected]>
Daniel
Juergen Gross
maintainerQuoted 10 lines · Juergen Gross
This patch series adds support for booting Linux as PVH guest.
Similar to i386/xen and x86_64/xen platforms the new i386/xenpvh platform grub is booted as a standalone image directly by Xen.
For booting Linux kernel it is using the standard linux kernel loader. The only modification of the linux loader is to pass the ACPI RSDP address via boot parameters to the kernel, as that table might not be located at the usual physical address just below 1MB.
Quoted 5 lines
As the related Linux kernel patches are not yet accepted please wait for this to happen before applying the series. This Linux kernel series is available under:
https://lists.xen.org/archives/html/xen-devel/2018-10/msg00776.html
The Linux kernel series is now available under:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/grub2
This means the series has been accepted and is kept pending until this grub2 series has been accepted.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerQuoted 10 lines · Juergen Gross
This patch series adds support for booting Linux as PVH guest.
Similar to i386/xen and x86_64/xen platforms the new i386/xenpvh platform grub is booted as a standalone image directly by Xen.
For booting Linux kernel it is using the standard linux kernel loader. The only modification of the linux loader is to pass the ACPI RSDP address via boot parameters to the kernel, as that table might not be located at the usual physical address just below 1MB.
Quoted 5 lines
As the related Linux kernel patches are not yet accepted please wait for this to happen before applying the series. This Linux kernel series is available under:
https://lists.xen.org/archives/html/xen-devel/2018-10/msg00776.html
The Linux kernel series is now available under:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/grub2
This means the series has been accepted and is kept pending until this grub2 series has been accepted.
Juergen