Left over patches from long-time ago.
PATCH v3 1/1 Left over patches from long-time ago.
Hey,
I was cleaning my mailbox and noticed that I still hadn't this done. This one was from 2016 and it looks like I just never sent it out (even thought I did the fix the next day). I never got to fix the other patch:
https://lists.xen.org/archives/html/xen-devel/2016-09/msg03191.html
Anyhow, sending the first out and will commit it next week if nobody complains.
The last reply was from Jan: [email protected]
https://lists.xen.org/archives/html/xen-devel/2016-09/msg03228.html
Thanks!
tools/firmware/hvmloader/e820.c | 6 +++--- tools/firmware/hvmloader/pci.c | 8 ++++---- tools/firmware/hvmloader/smbios.c | 5 ++--- tools/firmware/hvmloader/util.h | 3 +++ 4 files changed, 12 insertions(+), 10 deletions(-)
Konrad Rzeszutek Wilk (1):
hvmloader: Use MB(x) and GB(x) macros
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v3 1/1 hvmloader: Use MB(x) and GB(x) macros
instead of hardcoding values. We also drop the uint64_t cast as the macro uses ULL to produce the proper width types.
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
v2: New submission
v3: Don't use leading underscores in macro.
- Drop the uint64_t cast
- Added Jan's Ack.
--- tools/firmware/hvmloader/e820.c | 6 +++--- tools/firmware/hvmloader/pci.c | 8 ++++---- tools/firmware/hvmloader/smbios.c | 5 ++--- tools/firmware/hvmloader/util.h | 3 +++ 4 files changed, 12 insertions(+), 10 deletions(-)
tools/firmware/hvmloader/e820.c +3 -3
@@ -82,7 +82,7 @@ void adjust_memory_map(void)/* Modify the existing highmem region if it exists. */ if ( memory_map.map[i].type ==E820_RAM && - high_mem_end && map_start == ((uint64_t )1 <<32 ) ) + high_mem_end && map_start ==GB (4 ) ) {if ( high_mem_end != map_end ) memory_map.map[i].size = high_mem_end - map_start;
@@ -94,7 +94,7 @@ void adjust_memory_map(void)/* If there was no highmem region, just create one. */ if ( high_mem_end ) { - memory_map.map[i].addr = ((uint64_t )1 <<32 ); + memory_map.map[i].addr =GB (4 ); memory_map.map[i].size = ((uint64_t )hvm_info->high_mem_pgend <<PAGE_SHIFT ) - memory_map.map[i].addr;
@@ -234,7 +234,7 @@ int build_e820_table(struct e820entry *e820, }/* Low RAM goes here. Reserve space for special pages. */ -BUG_ON (low_mem_end < (2u <<20 )); +BUG_ON (low_mem_end <MB (2 ));/* * Construct E820 table according to recorded memory map.
tools/firmware/hvmloader/pci.c +4 -4
@@ -59,7 +59,7 @@ static int find_next_rmrr(uint32_t base) {unsigned int i;int next_rmrr =-1 ; -uint64_t end, min_end =1ULL <<32 ; +uint64_t end, min_end =GB (4 );for ( i =0 ; i < memory_map.nr_map ; i++ ) {
@@ -297,7 +297,7 @@ void pci_setup(void)if ( mmio_hole_size ) { -uint64_t max_ram_below_4g = (1ULL <<32 ) - mmio_hole_size; +uint64_t max_ram_below_4g =GB (4 ) - mmio_hole_size;if ( max_ram_below_4g >HVM_BELOW_4G_MMIO_START ) {
@@ -385,13 +385,13 @@ void pci_setup(void)adjust_memory_map (); high_mem_resource.base = ((uint64_t )hvm_info->high_mem_pgend) <<PAGE_SHIFT ; -if ( high_mem_resource.base <1ull <<32 ) +if ( high_mem_resource.base <GB (4 ) ) {if ( hvm_info->high_mem_pgend !=0 )printf ("WARNING: hvm_info->high_mem_pgend %x" " does not point into high memory!" , hvm_info->high_mem_pgend); - high_mem_resource.base =1ull <<32 ; + high_mem_resource.base =GB (4 ); } printf("%sRAM in high memory; setting high_mem resource base to "PRIllx"\n", hvm_info->high_mem_pgend?"":"No ",
tools/firmware/hvmloader/smbios.c +2 -3
@@ -239,15 +239,14 @@ get_memsize(void) sz = (uint64_t )hvm_info->low_mem_pgend <<PAGE_SHIFT ;if ( hvm_info->high_mem_pgend ) - sz += (((uint64_t )hvm_info->high_mem_pgend <<PAGE_SHIFT ) - - (1ull <<32 )); + sz += (((uint64_t )hvm_info->high_mem_pgend <<PAGE_SHIFT ) -GB (4 ));/* * Round up to the nearest MB. The user specifies domU pseudo-physical * memory in megabytes, so not doing this could easily lead to reporting * one less MB than the user specified. */ -return (sz + (1ul <<20 ) -1 ) >>20 ; +return (sz +MB (1 ) -1 ) >>20 ; }void
tools/firmware/hvmloader/util.h +3 -0
@@ -48,6 +48,9 @@ void __bug(char *file, int line) __attribute__((noreturn));#define max_t (type,x,y) \ ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) +#define MB (mb) (mb##ULL << 20) +#define GB (gb) (gb##ULL << 30) +static inline int test_bit (unsigned int b,const void *p) {return !!(((const uint8_t *)p)[b>>3 ] & (1u <<(b&7 )));
Signature · 7 lines
2.13.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH v3] hvmloader: Use MB(x) and GB(x) macros
Quoted 6 lines · Konrad Rzeszutek Wilk
instead of hardcoding values. We also drop the
uint64_tcast as the macro uses ULL to produce the proper width types.Acked-by Jan Beulich <[email protected]>Signed-off-by Konrad Rzeszutek Wilk <[email protected]>
You've got Jan's ack so you can commit it right away. :-)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v3] hvmloader: Use MB(x) and GB(x) macros
Quoted 9 lines · Wei Liu
Quoted 6 lines · Konrad Rzeszutek Wilk
instead of hardcoding values. We also drop the
uint64_tcast as the macro uses ULL to produce the proper width types.Acked-by Jan Beulich <[email protected]>Signed-off-by Konrad Rzeszutek Wilk <[email protected]>You've got Jan's ack so you can commit it right away. :-)
True, but that was a year ago. It may have expired.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v3] hvmloader: Use MB(x) and GB(x) macros
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 15.09.17 at 19:25, <[email protected]> wrote:
Quoted 5 lines · Wei Liu
Quoted 4 lines · Konrad Rzeszutek Wilk
instead of hardcoding values. We also drop the
uint64_tcast as the macro uses ULL to produce the proper width types.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Acked-by Jan Beulich <[email protected]>Signed-off-by Konrad Rzeszutek Wilk <[email protected]>You've got Jan's ack so you can commit it right away. :-)
True, but that was a year ago. It may have expired.
Why would it?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel