hw/xen: Build only once
cover hw/xen: Build only once
Replace target-specific code to allow building
hw/xen/ files once.
Philippe Mathieu-Daudé (3):
hw/xen: Use BITS_PER_BYTE & MAKE_64BIT_MASK() in req_size_bits() hw/xen: Replace target_ulong by agnostic target_long_bits() hw/xen: Build only once
hw/xen/xen-hvm-common.c | 9 ++++++--- hw/xen/meson.build | 22 +++++++++------------- 2 files changed, 15 insertions(+), 16 deletions(-)
Signature · 1 line
2.51.0
PATCH 1/3 hw/xen: Use BITS_PER_BYTE & MAKE_64BIT_MASK() in req_size_bits()
Replace magic 8 by BITS_PER_BYTE, use MAKE_64BIT_MASK() instead of open coding it.
--- hw/xen/xen-hvm-common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
hw/xen/xen-hvm-common.c +4 -1
@@ -1,5 +1,6 @@#include "qemu/osdep.h" #include "qemu/units.h" +#include "qemu/bitops.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "exec/target_long.h"
@@ -448,12 +449,14 @@ static void cpu_ioreq_config(XenIOState *state, ioreq_t *req)static void handle_ioreq (XenIOState *state,ioreq_t *req) { +size_t req_size_bits = req->size *BITS_PER_BYTE ; +trace_handle_ioreq (req, req->type, req->dir, req->df, req->data_is_ptr, req->addr, req->data, req->count, req->size);if (!req->data_is_ptr && (req->dir ==IOREQ_WRITE ) && (req->size <sizeof (target_ulong))) { - req->data &= ((target_ulong )1 << (8 * req->size)) -1 ; + req->data &=MAKE_64BIT_MASK (0 , req_size_bits); }if (req->dir ==IOREQ_WRITE )
Signature · 1 line
2.51.0
Re: [PATCH 1/3] hw/xen: Use BITS_PER_BYTE & MAKE_64BIT_MASK() in req_size_bits()
Quoted 7 lines · Philippe Mathieu-Daudé
Replace magic 8 by
BITS_PER_BYTE, useMAKE_64BIT_MASK()instead of open coding it.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/xen/xen-hvm-common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Re: [PATCH 1/3] hw/xen: Use BITS_PER_BYTE & MAKE_64BIT_MASK() in req_size_bits()
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
Replace magic 8 by
BITS_PER_BYTE, useMAKE_64BIT_MASK()instead of open coding it.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 34 lines
--- hw/xen/xen-hvm-common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)hw/xen/xen-hvm-common.c +4
-1@@ -1,5 +1,6 @@#include "qemu/osdep.h" #include "qemu/units.h" +#include "qemu/bitops.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "exec/target_long.h" @@ -448,12 +449,14 @@ static void cpu_ioreq_config(XenIOState *state, ioreq_t *req)static void handle_ioreq (XenIOState *state,ioreq_t *req) { +size_t req_size_bits = req->size *BITS_PER_BYTE ; +trace_handle_ioreq (req, req->type, req->dir, req->df, req->data_is_ptr, req->addr, req->data, req->count, req->size);if (!req->data_is_ptr && (req->dir ==IOREQ_WRITE ) && (req->size <sizeof (target_ulong))) { - req->data &= ((target_ulong )1 << (8 * req->size)) -1 ; + req->data &=MAKE_64BIT_MASK (0 , req_size_bits); }if (req->dir ==IOREQ_WRITE )Signature · 1 line
2.51.0
PATCH 2/3 hw/xen: Replace target_ulong by agnostic target_long_bits()
In reply to Philippe Mathieu-DaudéBoth are equivalent:
target_long_bits()
sizeof(target_u?long) * BITS_PER_BYTE
Prefer the former which is target-agnostic.
--- hw/xen/xen-hvm-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/xen/xen-hvm-common.c +2 -2
@@ -2,8 +2,8 @@#include "qemu/units.h" #include "qemu/bitops.h" #include "qemu/error-report.h" +#include "qemu/target-info.h" #include "qapi/error.h" -#include "exec/target_long.h" #include "exec/target_page.h" #include "trace.h"
@@ -455,7 +455,7 @@ static void handle_ioreq(XenIOState *state, ioreq_t *req) req->addr, req->data, req->count, req->size);if (!req->data_is_ptr && (req->dir ==IOREQ_WRITE ) && - (req->size <sizeof (target_ulong))) { + (req_size_bits <target_long_bits ())) { req->data &=MAKE_64BIT_MASK (0 , req_size_bits); }
Signature · 1 line
2.51.0
Re: [PATCH 2/3] hw/xen: Replace target_ulong by agnostic target_long_bits()
Quoted 4 lines · Philippe Mathieu-Daudé
Both are equivalent:
target_long_bits()
Quoted 8 lines
sizeof(target_u?long)*BITS_PER_BYTEPrefer the former which is target-agnostic.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/xen/xen-hvm-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Re: [PATCH 2/3] hw/xen: Replace target_ulong by agnostic target_long_bits()
In reply to Philippe Mathieu-DaudéQuoted 9 lines · Philippe Mathieu-Daudé
Both are equivalent:
target_long_bits()
sizeof(target_u?long)*BITS_PER_BYTEPrefer the former which is target-agnostic.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 30 lines
--- hw/xen/xen-hvm-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/xen/xen-hvm-common.c +2
-2@@ -2,8 +2,8 @@#include "qemu/units.h" #include "qemu/bitops.h" #include "qemu/error-report.h" +#include "qemu/target-info.h" #include "qapi/error.h" -#include "exec/target_long.h" #include "exec/target_page.h" #include "trace.h" @@ -455,7 +455,7 @@ static void handle_ioreq(XenIOState *state, ioreq_t *req) req->addr, req->data, req->count, req->size);if (!req->data_is_ptr && (req->dir ==IOREQ_WRITE ) && - (req->size <sizeof (target_ulong))) { + (req_size_bits <target_long_bits ())) { req->data &=MAKE_64BIT_MASK (0 , req_size_bits); }Signature · 1 line
2.51.0
PATCH 3/3 hw/xen: Build only once
In reply to Philippe Mathieu-DaudéNow than hw/xen/ files don't use any target-specific code, we can build all file units once, removing the need for the xen_specific_ss[] source set.
--- hw/xen/meson.build | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
hw/xen/meson.build +9 -13
@@ -7,21 +7,16 @@ system_ss.add(when: ['CONFIG_XEN_BUS'], if_true: files( 'xen_pvdev.c', )) -system_ss.add(when: ['CONFIG_XEN', xen], if_true: files( - 'xen-operations.c', -), -if_false: files( - 'xen_stubs.c', -)) - -xen_specific_ss = ss.source_set() -xen_specific_ss.add(files( - 'xen-mapcache.c', +xen_common_ss = ss.source_set() +xen_common_ss.add(files( 'xen-hvm-common.c', + 'xen-mapcache.c', + 'xen-operations.c', 'xen-pvh-common.c', )) + if have_xen_pci_passthrough - xen_specific_ss.add(files( + xen_common_ss.add(files( 'xen-host-pci-device.c', 'xen_pt.c', 'xen_pt_config_init.c',
@@ -30,7 +25,8 @@ if have_xen_pci_passthrough 'xen_pt_msi.c', )) else - xen_specific_ss.add(files('xen_pt_stub.c')) + xen_common_ss.add(files('xen_pt_stub.c')) endif -specific_ss.add_all(when: ['CONFIG_XEN', xen], if_true: xen_specific_ss) +system_ss.add_all(when: ['CONFIG_XEN', xen], if_true: xen_common_ss) +system_ss.add(when: ['CONFIG_XEN', xen], if_false: files('xen_stubs.c'))
Signature · 1 line
2.51.0
Quoted 8 lines · Philippe Mathieu-Daudé
Now than hw/xen/ files don't use any target-specific code, we can build all file units once, removing the need for the xen_specific_ss[] source set.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/xen/meson.build | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
Quoted 5 lines · Philippe Mathieu-Daudé
Now than hw/xen/ files don't use any target-specific code, we can build all file units once, removing the need for the xen_specific_ss[] source set.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 50 lines
--- hw/xen/meson.build | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)hw/xen/meson.build +9
-13@@ -7,21 +7,16 @@ system_ss.add(when: ['CONFIG_XEN_BUS'], if_true: files( 'xen_pvdev.c', )) -system_ss.add(when: ['CONFIG_XEN', xen], if_true: files( - 'xen-operations.c', -), -if_false: files( - 'xen_stubs.c', -)) - -xen_specific_ss = ss.source_set() -xen_specific_ss.add(files( - 'xen-mapcache.c', +xen_common_ss = ss.source_set() +xen_common_ss.add(files( 'xen-hvm-common.c', + 'xen-mapcache.c', + 'xen-operations.c', 'xen-pvh-common.c', )) + if have_xen_pci_passthrough - xen_specific_ss.add(files( + xen_common_ss.add(files( 'xen-host-pci-device.c', 'xen_pt.c', 'xen_pt_config_init.c',@@ -30,7 +25,8 @@ if have_xen_pci_passthrough 'xen_pt_msi.c', )) else - xen_specific_ss.add(files('xen_pt_stub.c')) + xen_common_ss.add(files('xen_pt_stub.c')) endif -specific_ss.add_all(when: ['CONFIG_XEN', xen], if_true: xen_specific_ss) +system_ss.add_all(when: ['CONFIG_XEN', xen], if_true: xen_common_ss) +system_ss.add(when: ['CONFIG_XEN', xen], if_false: files('xen_stubs.c'))Signature · 1 line
2.51.0
Quoted 7 lines · Philippe Mathieu-Daudé
Replace target-specific code to allow building
hw/xen/ files once.Philippe Mathieu-Daudé (3):
hw/xen: UseBITS_PER_BYTE&MAKE_64BIT_MASK()inreq_size_bits()hw/xen: Replacetarget_ulongby agnostictarget_long_bits()hw/xen: Build only once
ping?
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé
Replace target-specific code to allow building
hw/xen/ files once.Philippe Mathieu-Daudé (3):
hw/xen: UseBITS_PER_BYTE&MAKE_64BIT_MASK()inreq_size_bits()hw/xen: Replacetarget_ulongby agnostictarget_long_bits()hw/xen: Build only onceping?
Series queued, thanks!