my bad, it's broken by rebase.. I re-posted these 2 patches, series should apply smoothly now:
https://groups.google.com/forum/#!msg/osv-dev/rRxExBFkhfI/E-i5PZT6AAAJ osv: aarch64: support processor::features() https://groups.google.com/forum/#!msg/osv-dev/rRxExBFkhfI/UG64vJT6AAAJ osv: aarch64: map Xen shared_info page -- regards, Sergiy On 03/21/2017 11:56 AM, Nadav Har'El wrote:
Hi, I cannot get this patch to apply cleanly after applying patches 1-3. Can you please send a new version of this patch? Thanks. -- Nadav Har'El [email protected] <mailto:[email protected]> On Fri, Mar 3, 2017 at 11:45 AM, 'Sergiy Kibrik' via OSv Development <[email protected] <mailto:[email protected]>> wrote: Features used by various Xen drivers, i.e. xenbus. Signed-off-by: Sergiy Kibrik <[email protected] <mailto:[email protected]>> --- arch/aarch64/cpuid.cc | 18 ++++++++++++++++++ arch/aarch64/cpuid.hh | 9 +++++++++ arch/aarch64/xen.cc | 28 ++++++++++++++++++++++++++++ arch/aarch64/xen.hh | 4 ++++ 4 files changed, 59 insertions(+) diff --git a/arch/aarch64/cpuid.cc b/arch/aarch64/cpuid.cc index 3ac4b24..daf820a 100644 --- a/arch/aarch64/cpuid.cc +++ b/arch/aarch64/cpuid.cc @@ -7,6 +7,7 @@ #include "cpuid.hh" #include "processor.hh" +#include "xen.hh" namespace processor { @@ -76,4 +77,21 @@ const std::string& features_str() return cpuid_str; } +void process_cpuid(features_type& features) +{ + xen::get_features(features); +} + +const features_type& features() +{ + // features() can be used very early, make sure it is initialized + static features_type f; + return f; +} + +features_type::features_type() +{ + process_cpuid(*this); +} + } diff --git a/arch/aarch64/cpuid.hh b/arch/aarch64/cpuid.hh index 919f62d..a97b605 100644 --- a/arch/aarch64/cpuid.hh +++ b/arch/aarch64/cpuid.hh @@ -28,6 +28,15 @@ enum hwcap_bit { HWCAP_BIT_N }; +struct features_type { + features_type(); + bool xen_clocksource; + bool xen_vector_callback; + bool xen_pci; +}; + +extern const features_type& features(); + } #endif /* CPUID_HH_ */ diff --git a/arch/aarch64/xen.cc b/arch/aarch64/xen.cc index 2e4a5fb..39354b0 100644 --- a/arch/aarch64/xen.cc +++ b/arch/aarch64/xen.cc @@ -8,13 +8,16 @@ #include <osv/types.h> #include <osv/xen.hh> #include <xen/interface/xen.h> +#include <xen/features.h> #include <bsd/porting/netport.h> /* __dead2 defined here */ #include <machine/xen/xen-os.h> #include <xen/evtchn.h> #include "arch-dtb.hh" +#include "cpuid.hh" shared_info_t *HYPERVISOR_shared_info; +uint8_t xen_features[XENFEAT_NR_SUBMAPS * 32]; namespace xen { @@ -22,6 +25,31 @@ shared_info_t dummy_info; struct xen_shared_info xen_shared_info __attribute__((aligned(4096))); constexpr int events_irq = 31; /*FIXME: get from FDT */ +/*TODO: this can be common x64/aarch64 code */ +void get_features(processor::features_type &features) +{ + if (!is_xen()) + return; + + for (unsigned int i = 0; i < XENFEAT_NR_SUBMAPS; i++) { + struct xen_feature_info info = { + .submap_idx = i, + }; + + if (HYPERVISOR_xen_version(XENVER_get_features, &info) < 0) + assert(0); + + for (int j = 0; j < 32; j++) + xen_features[i * 32 + j] = !!(info.submap & 1<<j); + } + + features.xen_clocksource = xen_feature(XENFEAT_hvm_safe_pvclock); + features.xen_vector_callback = xen_feature(XENFEAT_hvm_callback_vector); + + if (!processor::features().xen_vector_callback) + evtchn_irq_is_legacy(); +} + static __attribute__((constructor)) void xen_init_irq() { if (!is_xen()) diff --git a/arch/aarch64/xen.hh b/arch/aarch64/xen.hh index aa5da27..d5046cb 100644 --- a/arch/aarch64/xen.hh +++ b/arch/aarch64/xen.hh @@ -8,8 +8,12 @@ #ifndef XEN_ARCH_HH #define XEN_ARCH_HH +#include "cpuid.hh" + namespace xen { +void get_features(processor::features_type &features); + } #endif /* XEN_ARCH_HH */ -- 2.7.4 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:osv-dev%[email protected]>. For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
-- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
