Thomas Gleixner | 457c899 | 2019-05-19 13:08:55 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 2 | /****************************************************************************** |
| 3 | * features.c |
| 4 | * |
| 5 | * Xen feature flags. |
| 6 | * |
| 7 | * Copyright (c) 2006, Ian Campbell, XenSource Inc. |
| 8 | */ |
| 9 | #include <linux/types.h> |
| 10 | #include <linux/cache.h> |
Paul Gortmaker | 59aa56b | 2016-02-21 19:06:04 -0500 | [diff] [blame] | 11 | #include <linux/export.h> |
Jeremy Fitzhardinge | ecbf29c | 2008-12-16 12:37:07 -0800 | [diff] [blame] | 12 | |
| 13 | #include <asm/xen/hypercall.h> |
| 14 | |
| 15 | #include <xen/interface/xen.h> |
| 16 | #include <xen/interface/version.h> |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 17 | #include <xen/features.h> |
| 18 | |
| 19 | u8 xen_features[XENFEAT_NR_SUBMAPS * 32] __read_mostly; |
| 20 | EXPORT_SYMBOL_GPL(xen_features); |
| 21 | |
| 22 | void xen_setup_features(void) |
| 23 | { |
| 24 | struct xen_feature_info fi; |
| 25 | int i, j; |
| 26 | |
| 27 | for (i = 0; i < XENFEAT_NR_SUBMAPS; i++) { |
| 28 | fi.submap_idx = i; |
| 29 | if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0) |
| 30 | break; |
| 31 | for (j = 0; j < 32; j++) |
| 32 | xen_features[i * 32 + j] = !!(fi.submap & 1<<j); |
| 33 | } |
| 34 | } |